Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hides commits from downstream branches #9

Open
Nemo157 opened this issue Feb 9, 2019 · 3 comments
Open

Hides commits from downstream branches #9

Nemo157 opened this issue Feb 9, 2019 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@Nemo157
Copy link

Nemo157 commented Feb 9, 2019

I have the current commit tree in my repository

* f2a4584 (min-version) Get min versions build working
* 5261bac (origin/all-the-ci) Cirrus CI
* 3ca1ca4 Circle CI
* a2e3d45 (HEAD -> travis, origin/travis) Fix clippy issues in tests
* c85d370 cargo fmt, again
* 37b490a Add travis config
* 8ea0653 (origin/master, origin/HEAD) Merge pull request #4 from Nemo157/fixes

I have changed the .travis.yml file and staged it, which should be absorbed into 37b490a, running git-absorb -v -n gives

Feb 09 17:23:06.222 DEBG repository found, path: /Users/nemo157/sources/cbor-diag-rs/.git/, line: 22, module: git_absorb
Feb 09 17:23:06.223 DEBG head found, head: refs/heads/travis, line: 26, module: git_absorb::stack
Feb 09 17:23:06.224 DEBG head pushed, head: refs/heads/travis, line: 35, module: git_absorb::stack
Feb 09 17:23:06.224 DEBG branch hidden, branch: refs/heads/fixes, line: 48, module: git_absorb::stack
Feb 09 17:23:06.225 DEBG branch hidden, branch: refs/heads/master, line: 48, module: git_absorb::stack
Feb 09 17:23:06.225 DEBG branch hidden, branch: refs/heads/min-version, line: 48, module: git_absorb::stack
Feb 09 17:23:06.225 DEBG branch not hidden, branch: refs/heads/travis, line: 51, module: git_absorb::stack
Feb 09 17:23:06.229 DEBG commuting hunk, header: -26,5 +25,0, path: .travis.yml, line: 93, module: git_absorb
Feb 09 17:23:06.230 DEBG could not find noncommutative commit, line: 156, module: git_absorb

Because it has hidden commits from min-version, a downstream branch from the one I'm currently fixing up, there are no commits available to absorb the change into. Deleting min-version and running git absorb -v -n again gives:

Feb 09 17:23:41.229 DEBG repository found, path: /Users/nemo157/sources/cbor-diag-rs/.git/, line: 22, module: git_absorb
Feb 09 17:23:41.230 DEBG head found, head: refs/heads/travis, line: 26, module: git_absorb::stack
Feb 09 17:23:41.231 DEBG head pushed, head: refs/heads/travis, line: 35, module: git_absorb::stack
Feb 09 17:23:41.232 DEBG branch hidden, branch: refs/heads/fixes, line: 48, module: git_absorb::stack
Feb 09 17:23:41.232 DEBG branch hidden, branch: refs/heads/master, line: 48, module: git_absorb::stack
Feb 09 17:23:41.232 DEBG branch not hidden, branch: refs/heads/travis, line: 51, module: git_absorb::stack
Feb 09 17:23:41.234 DEBG commit pushed onto stack, commit: a2e3d45c498c4693c2197b8125d98f5e65e93cf0, line: 75, module: git_absorb::stack
Feb 09 17:23:41.235 DEBG commit pushed onto stack, commit: c85d370703849bf12196e91b78cb410fc14e057e, line: 75, module: git_absorb::stack
Feb 09 17:23:41.236 DEBG commit pushed onto stack, commit: 37b490a805ca4b94ba68f88acb2347cdbc76ea0f, line: 75, module: git_absorb::stack
Feb 09 17:23:41.237 WARN merge commit found, commit: 8ea0653e9d2e1a83f48a3aefa15424bbe09352ef, line: 62, module: git_absorb::stack
Feb 09 17:23:41.249 DEBG commuting hunk, header: -26,5 +25,0, path: .travis.yml, line: 93, module: git_absorb
Feb 09 17:23:41.249 DEBG skipped commit with no path, commit: a2e3d45c498c4693c2197b8125d98f5e65e93cf0, line: 117, module: git_absorb
Feb 09 17:23:41.250 DEBG skipped commit with no path, commit: c85d370703849bf12196e91b78cb410fc14e057e, line: 117, module: git_absorb
Feb 09 17:23:41.250 DEBG found noncommutative commit by add, commit: 37b490a805ca4b94ba68f88acb2347cdbc76ea0f, line: 122, module: git_absorb
Feb 09 17:23:41.251 INFO would have committed, header: -26,5 +25,0, fixup: Add travis config, line: 185, module: git_absorb

I'm not sure of the best solution here to support all usecases, I think personally what I would want is for git-absorb to walk down the first parent line from the current commit until it encounters any branch (local or remote) and hide commits from that point, you might notice I don't use a local master branch so the current behaviour of only hiding local branches would fail to correctly identify the point at which to stop anyway.

(EDIT: Sorry, accidentally submitted this with an old issue I was writing before I managed to debug where this was actually going wrong)

@Nemo157
Copy link
Author

Nemo157 commented Feb 9, 2019

(For now I'm working around this with an alias abs = absorb -b origin/HEAD which should cover most of my uses correctly)

@tummychow
Copy link
Owner

hmm, very interesting. just to make sure i understand - that commit tree you mentioned, it's a linear sequence? you have travis checked out right now, but you also have local branches that are descendants of travis, so git-absorb hides those branches from the commit stack and there's nothing to commute into.

let me noodle on this a bit. i think you have at least two (non-mutually-exclusive) suggestions that are interesting here:

  • we should be able to toggle hiding remote heads as well as local heads
  • since you're on the travis branch, we should be able to infer the default push remote's default branch and maybe the base should default to that. i've written a lot of weird push/pull default manipulating code in a past project that i can probably reuse here

@Nemo157
Copy link
Author

Nemo157 commented Feb 10, 2019

that commit tree you mentioned, it's a linear sequence? you have travis checked out right now, but you also have local branches that are descendants of travis, so git-absorb hides those branches from the commit stack and there's nothing to commute into.

Yep

@tummychow tummychow added the help wanted Extra attention is needed label Jul 14, 2019
nickolay added a commit to nickolay/git-absorb that referenced this issue Jul 14, 2019
- Print "Please use --base to specify the base commit." when all the
  commits were "hidden" by other branches. (This makes the misbehavior
  described in tummychow#9 less confusing.)

- Instead of noting that "merge commit found", explain what it means to
  the user: "Will not fix up past the merge commit".

- Provide suggestions when "stack limit reached": "use --base or
  configure absorb.maxStack to override"

  - Don't honor absorb.maxStack with explicit --base

- Note if the stack is empty: "No commits available to fix up, exiting"

- Warn if "No additions staged, try adding something to the index."

- Print "Could not find a commit to fix up, use --base to increase the
  search range." instead of "could not find noncommutative commit", and
  display this message by default (without the verbose mode)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants