Re: "git stash pop" is doing an unwanted "git add" when there are conflicts.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 29, 2015 at 11:04:20AM -0800, Junio C Hamano wrote:

> [...]
> In the above, I suggested to "git reset" when there is no conflict.
> I think this line of thinking can be followed even further to
> selectively reset the paths that were cleanly merged (which is added
> by the call to merge-recursive), leaving _only_ the conflicted paths.
> 
> Would that give us a better outcome?  I dunno.

Yes, I think that is the only sensible change to make. The only other
option (besides leaving it as-is) would be to unstage _everything_
leaving conflict-marker cruft in the working tree, but no conflicts in
the index. I think that's a mistake, but I won't repeat the arguments I
left elsewhere in the thread.

So it's probably something like:

  git ls-files -t |
  grep -v ^M |
  cut -d ' ' -f2- |
  xargs git reset --

(modulo some quoting robustness improvements). But I guess we'd want to
preserve any modifications that were originally in the index. So maybe
the intersection of the files above and the output of "git diff-tree
--name-only" on the stash commit.

There are probably some corner cases to look at (e.g., with "--index").

As I said, I'm not planning to work on it anytime soon, but the above
may give some clues to somebody who wants to pursue it.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]