[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when
Re: [Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when dealing with a stash conflict
Mon, 20 Apr 2015 11:25:34 -0400
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)
>> Better would be for vc-git-resolve-when-done to check the status of the
>> file and only `git add' it if it doesn't have anything staged yet. So,
>> it would still work as before in the case where there was nothing staged
>> before the "stash pop".
> Hmm, it seem I can't really detect whether the file had something staged
> (whether the conflict is due to that, or some new commits, 'git
> diff --cached', for instance, only says '* Unmerged path test2').
"git status --porcelain <file>" gives me:
for a file with staged changes
" M <file>"
for a modified file with no staged changes, and
for a modified file with both staged and unstaged changes. So I think
that looking for "\\`M" in the output of "git status --porcelain"
Of course, what I'm proposing would still add the file to the staging
area, even if the user did not originally intend to do so, but at least
there's no serious loss of information (the only loss of information is
"which files(s)'s changes were already staged and which weren't").
> Guess I'm not enough of an aficionado, then. After plenty of searching and
> reading the man pages, 'git add' followed by 'git reset' is the best I have.
Well, if you're not afraid of getting gross, you could do something
along the lines of:
unstaged=$(git diff -- <file>)
git add <file>
echo "$unstaged" | patch -R -p1
git add <file>
echo "$unstaged" | patch -p1
Re: [Emacs-diffs] master b5b0e05: Call `smerge-start-session' even when dealing with a stash conflict, Eli Zaretskii, 2015/04/20