Giter Site home page Giter Site logo

gg's People

Contributors

dependabot[bot] avatar ijt avatar zombiezen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

ijt

gg's Issues

Add sync command/alias

sync is an alias for gg pull && gg evolve && gg rebase. The flags should be some subset of the union of the flags for pull, evolve, and rebase.

Clean up histedit/rebase output

gg histedit and gg rebase pass through a bunch of output from git rebase. While some of it is helpful, it's not organized particularly well. Especially after fixing #21, there's a bunch of output suggesting Git commands where there are more idiomatic gg counterparts that have more safeguards. It would be good to extract the same information, and then always run git rebase with --quiet. This will require a bit of research to see what git rebase outputs under different circumstances (e.g. merge conflicts, finishing the rebase, running continue when there are unmerged paths).

rebase command

There should be a rebase command. This is largely the same between git and Mercurial.

gg add internals are confusing when given a directory

I know this is broken because I've examined the code, but I still need to create a test case.

Steps to Reproduce

$ gg init
$ mkdir foo
$ echo hello > foo/bar.txt
$ gg add .
$ gg commit -m "initial import"

$ echo goodbye > foo/bar.txt
$ gg commit -m "farewell"

$ gg branch -r HEAD~ feature
$ gg up feature
$ echo wutevs > foo/bar.txt
$ gg commit -m "meh"

$ gg up master
$ gg merge feature
Auto-merging foo/bar.txt
CONFLICT (content): Merge conflict in foo/bar.txt
Automatic merge failed; fix conflicts and then commit the result.
gg: run git merge: exit status 1
$ echo sup > foo/baz.txt
$ gg -show-git add foo

Expected Behavior

# various things
gg: exec: git add -N -- :(top, literal)foo/baz.txt
gg: exec: git add -- :(top, literal)foo/bar.txt

Actual Behavior

gg: exec: git rev-parse --show-toplevel
gg: exec: git status --porcelain -z -unormal -- :(top,literal)foo
gg: exec: git add -N -- :(top,literal)foo
gg: exec: git add -- :(top,literal)foo/bar.txt

Version Info

gg version 0.5.1, built on 2018-05-31T21:55:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4

diff should include some of the algorithm control options

Occasionally, I need something like --ignore-all-space or other lesser-used diff options. It would be good to add these.

Version Info

gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4

Document preferred way to perform certain workflows

It would be good to have docs for how to use gg for each of the Gerrit workflow, shared GitHub repository workflow, and GitHub fork-and-pull workflow, especially since gg is rather opinionated about how to set up each of these things.

macOS packaging

Binaries work pretty well for macOS, but packaging would be nice for keeping up-to-date. Seems like the two main distribution mechanisms here would be Homebrew and a native package. Probably need a man page, like in #49.

gg push -create=0 checks fetch URL instead of push URL

Steps to Reproduce

gg clone https://example.com/foo/bar.git
cd bar
git remote set-url --push origin https://example.com/foo/bar-fork.git
gg branch newbranch
gg push -create
touch foo.txt && gg add foo.txt && gg ci -m "did something random"
gg push

Expected Behavior

Ref newbranch is updated on https://example.com/foo/bar-fork.git

Actual Behavior

Fails with the following message:

gg: remote origin does not have ref refs/heads/newbranch

Version Info

gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4

Windows packaging

Windows users usually expect an installer. I believe MSI is the right technology, not a Windows Store program. I'm not particularly knowledgable, so if anyone has insight here, I'd appreciate it.

(Blocked on #47)

gg histedit also rebases onto upstream

gg rebase and gg histedit fill different roles: rebase should be reparenting, and histedit should be editing changes. Thus, running a histedit should not change the parent that the stack of changes is based on.

Steps to Reproduce

gg init
touch foo.txt
gg add foo.txt
gg ci -m "first commit"

gg branch foo
echo somechange > foo.txt
gg ci -m "this is a feature"

gg up master
echo upstreamchange > foo.txt
gg ci -m "life moves on"

gg up foo
gg histedit
# edit foo's change, finish rebase

Expected Behavior

Commit's parent is the first commit (the original base of the stack)

Actual Behavior

Commit's parent is the upstream's commit

Version Info

gg version 0.4.0, built on 2018-04-18T14:34:41Z
go: go1.10 gc linux/amd64
git version 2.17.0.484.g0c8726318c-goog

gg binary doubled in size between 0.2 and 0.3

Because I pulled in net/http for gerrithook, gg has gone from a ~3MiB binary to a ~6MiB binary. Not the worst thing, but certainly a lot of binary size for a little feature. ๐Ÿ™

Use upstream in pull default

Unlike push, which generally makes sense to push to the same branch, it is quite common to want to pull the upstream. Especially in conjunction with #15, this seems like more helpful behavior.

gg rebase -src only works when HEAD is the descendant of the argument

Admittedly, this is clearer in Mercurial than Git, since Mercurial can look for descendants without knowing a ref. Rebase could walk all of the local branches (refs/heads/*) to find potential descendant lines, I suppose.

Steps to Reproduce

gg init
echo hello > foo.txt && gg add foo.txt
gg ci -m "first commit"

gg branch topic
echo hello > bar.txt && gg add bar.txt
gg ci -m "this is feature 1"
echo hello > baz.txt && gg add baz.txt
gg ci -m "this is feature 2"

gg up master
gg rebase -src=`git rev-parse topic` -dst=HEAD

Expected Behavior

A commit with baz.txt is created on top of the first commit.

Actual Behavior

No commit is created and rebase exits successfully

Version Info

gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4

commit does not work in a subdirectory when files are removed

Don't have a repro for this one yet, but the :/: syntax doesn't seem to work in a subdirectory if the file is being removed in the working copy.

Version

gg built from source at c04b2e81151522d7494fba23de1a11640f6670bc on 2018-03-28T17:14:00Z
go: go1.10 gc darwin/amd64
git version 2.16.2.804.g6dcf76e118-goog

Add evolve command to rebase matching change IDs

A common scenario in Gerrit-based workflows is having a change cherry-picked into master and then needing to rebase the rest of your feature branch on the new changeset. In Mercurial land, this is called changeset evolution.

Right now, I'm manually aligning the beginning of the new changes and performing gg rebase -src=COMMIT -dst=master on my topic branch. This can be automated by having gg sniff the Change ID lines from the commit.

Add gg cat command

I always miss the simplicity of hg cat, and while I don't use it often, looking up the correct git cat-file invocation is always painful. Bring on the cats!

bash completion

It would be good to have gg have a mode to spit out a bash completion file. It seems that most modern shells (including zsh) can understand the bash completion language, so this should be sufficient.

merge should not try to create a merge commit

The hg merge command never creates a merge commit. The assumption is that you will run tests and make sure the merge was successful. gg merge should follow the same tradition, but does not right now, since that is not Git's default behavior.

mail should warn if working copy has changes

Just got bit by this: I'd like for mail to bail early (overridable by flag) if there are local changes in the working copy, so that then I have the chance to amend the commit.

Windows support

It would be nice to have Windows support. While I don't develop on Windows regularly, I feel confident enough in the test suite that if I start running Windows in CI (probably using AppVeyor) that it would work fairly well. Shipping Windows binaries would be easy at that point.

Rebase with fork point makes certain rebases behave unexpectedly

I just recently hit an issue where the implicit --fork-point messed up a rebase where I had set the upstream to a local branch and done a dance with dependent feature branches.

Steps to Reproduce

$ gg init
$ touch foo.txt && gg add foo.txt && gg commit -m "first"
$ touch bar.txt && gg add bar.txt && gg commit -m "second"
$ gg branch feature
$ gg up master
$ git reset --hard HEAD~
HEAD is now at f950f8a first
$ touch baz.txt && gg add baz.txt && gg commit -m "third"
$ gg up feature
Branch 'feature' set up to track local branch 'master'.
$ gg rebase -dst=master

Expected Behavior

The second commit is rebased on top of the third commit.

Actual Behavior

The feature branch is forcibly reset to master.

First, rewinding head to replay your work on top of it...
$ git rev-parse master feature
f1dd4c2894062a83ebae024077922315f410f00a
f1dd4c2894062a83ebae024077922315f410f00a

Version Info

gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0

gg add on whole repository fails

Steps to Reproduce

gg init
touch foo.txt
gg add .

Expected Behavior

Adds all unignored files.

Actual Behavior

gg: file "/path/to/repo" is outside the working copy; cannot be added

Version Info

gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4

Add command to query/set upstream

The Git CLI has branch --set-upstream-to, but AFAICT no direct way of querying what a branch's upstream is set to. Since this is a pretty fundamental concept, it would be good to have a command that directly pokes at the config settings.

gg pull should fetch tags

Tags should likely be the exception to the "only pull one ref" rule, since it's laborious to go find out what all of the new tags are.

histedit does not accept non-ref arguments

(rebase is likely affected too, since this appears to be a problem with calling git merge-base --fork-point with a non-ref argument.)

Steps to Reproduce

gg init
touch foo.txt && gg add foo.txt && gg ci -m "initial import"
echo foo > foo.txt && gg ci -m "second change"
gg histedit HEAD~

Expected Behavior

Editor opens rebase plan with second change.

Actual Behavior

gg histedit exits with error:

fatal: No such ref: 'HEAD~2'
gg: run git merge-base: exit status 128

Version Info

gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4

Add gg backout command

While I don't use backout every day, looking up the correct git invocation is painful. Add gg backout.

gg commit does not finish merge

Steps to Reproduce

$ gg merge origin/master
# experience merge conflicts
$ gg add conflict.txt
$ gg commit

Expected Behavior

gg opens editor with merge commit message.

Actual Behavior

fatal: cannot do a partial commit during a merge.
gg: run git commit: exit status 128

Version Info

gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0

gg push -f does not work well with different push URL

Since gg push -f uses git push --force-with-lease, it can get confused if the pushed refs are not present as remote tracking branches. I'm not sure how to fix this, but it is definitely clunkier than I'd like.

Steps to Reproduce

$ gg clone https://github.com/example/foo.git foo
$ cd foo
$ git remote set-url --push origin ssh://[email protected]/myuser/foo.git
$ gg branch feature
$ gg push -create
# hack hack hack
# also change remote ref
$ gg commit -amend
$ gg push -f
$ gg push -f

Expected Behavior

gg push succeeds.

Actual Behavior

gg push exits with:

To ssh://github.com/myuser/foo.git
 ! [rejected]        1234deadbeef1234 -> feature (stale info)
error: failed to push some refs to 'ssh://[email protected]/myuser/foo.git'
gg: run git push: exit status 1

Version Info

gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0

Decide on git requirement

Since I've already hit some git compatibility issues during development, it would be good to:

  • Decide the minimum version of Git that gg requires
  • Run tests on the old version and a modern version

Keep backup files for revert

I'd like to replicate the hg revert functionality of keeping a backup file for any reverted file. There is nothing in git checkout that does this, so likely gg revert would have to roll its own behavior.

Create online documentation

I'd like to have an online version of the reference documentation, not just in-tool. The build process should be automated, so that a new copy is published with each release. Something with GitHub pages is probably the right approach.

Add uncommit command

It would be nice to replicate the Mercurial uncommit command. Synopsis:

gg uncommit [FILE [...]]

uncommit part or all of a local commit

Running gg uncommit without any arguments should behave like git reset --soft HEAD~.

Running gg uncommit with arguments should do something like:

# Update index with previous state of files, but don't modify the working tree.
git reset -q HEAD~ -- FILE1 FILE2 ...
# Now roll back the HEAD ref.
git reset --soft HEAD~

Tricky part will be to ensure this works on the first commit as well: this shouldn't introduce any bugs like #30.

/cc @ianthehat, who requested this feature.

deb packaging

While shipping binaries is fine for Linux, it would also be convenient to have packaging for more convenient updates and management. This probably should include a minimal man page that points to the doc site and the built-in help command.

Stage changes during rebase/histedit -continue

Based on a suggestion by Austin Clements to never use commit --amend during a rebase, I'd like to enable the same flow in gg. The problem is that in order for this to work, the working copy must be clean and the index must include all the necessary changes: gg add specifically does not add new changes to the index.

Steps to Reproduce

gg init
touch foo.txt && gg add foo.txt && gg ci -m "initial commit"
echo "mychange" > foo.txt && gg ci -m "second commit"

gg histedit HEAD~
# edit abcdef second commit
echo "my new change" > foo.txt

gg histedit -continue

Expected Behavior

The rebase proceeds and completes successfully.

Actual Behavior

histedit exits with failure.

Version Info

gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.17.0.484.g0c8726318c-goog

merge commands

There should be merge and resolve commands. Merge should be a git merge --no-ff.

Renamed file added by gg causes status to crash

Steps to Reproduce

EDIT 2018-07-08: Added reproduction steps.

$ gg init
$ touch foo.txt
$ gg add .
$ gg commit -m "first"
$ mv foo.txt bar.txt
$ gg add bar.txt
$ gg status

Expected Behavior

status succeeds with:

A bar.txt
! foo.txt

Actual Behavior

status exits with:

gg: read status entry: invalid code ' ' 'R'

Version Info

gg built from source at 6a7382d3be3b54f4210b7a662f2e23250497ad35 on 2018-05-31T17:04:04Z with local modifications
go: go1.10.2 gc linux/amd64
git version 2.17.0

gg diff before first commit fails

Steps to Reproduce

gg init
echo Hello > foo.txt
gg add foo.txt
gg diff

Expected Behavior

Shows the staged diff

Actual Behavior

fatal: bad revision 'HEAD'
gg: run git diff: exit status 128

Version Info

gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4

commit -amend errors out if nothing changed

Steps to reproduce:

$ gg init
$ echo foo > foo.txt
$ gg add foo.txt
$ gg commit -m "mumble"
$ gg commit --amend

Expected behavior:

Editor opens with commit message.

Actual behavior:

Failure with output:

gg: nothing changed

gg mail should infer destination via descendants for non-ref revisions

Now that gg has logic for detecting descendants, it would be good to use this in gg mail's destination inference when working on a topic branch.

Steps to Reproduce

# existing gerrit clone
gg branch myfeature
# hack
gg ci -m "first commit"
# hack
gg ci -m "second commit"
gg mail -r HEAD~

Expected Behavior

gg mail infers destination as master.

Actual Behavior

gg mail exits because it can't infer destination since HEAD~ is not a ref.

Version Info

gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4

mail command

There should be a special case of push that pushes a Gerrit change, optionally setting the parameters detailed in Uploading Changes

Commit with no arguments logs noisy "fatal" error

Steps to Reproduce

$ gg init
$ touch foo.txt && gg add foo.txt
$ gg commit -m "first commit"

Expected Behavior

Commit succeeds silently (no output).

Actual Behavior

Commit succeeds with:

fatal: Not a valid object name MERGE_HEAD

Version Info

gg version 0.5.0, built on 2018-05-31T00:37:28Z
go: go1.10.1 gc linux/amd64
git version 2.17.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.