zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
@ 2015-09-23 18:55 Daniel Hahler
  2015-09-28  1:34 ` Daniel Shahaf
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Hahler @ 2015-09-23 18:55 UTC (permalink / raw)
  To: zsh-workers

From: Daniel Hahler <git@thequod.de>

When pressing Ctrl-C after `git am`, only `last` exists in
`.git/rebase-apply/`, which is empty.

This patch fixes it to fall back to "no patch applied" then.
---
 Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 25 +++++++++++++----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
index 638ea45..8ecc7c7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git
@@ -217,18 +217,21 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then
 elif [[ -d "${gitdir}/rebase-apply" ]]; then
     # Fake patch names for all but current patch
     patchdir="${gitdir}/rebase-apply"
-    local cur=$(< "${patchdir}/next")
-    local p subject
-    for p in $(seq $(($cur - 1))); do
-        git_patches_applied+=("$(printf "%04d" $p) ?")
-    done
-    subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
-    if [[ -f "${patchdir}/original-commit" ]]; then
-        git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
-    else
-        git_patches_applied+=("? $subject")
+    local next="${patchdir}/next"
+    if [[ -f $next ]]; then
+	local cur=$(< $next)
+	local p subject
+	for p in $(seq $(($cur - 1))); do
+	    git_patches_applied+=("$(printf "%04d" $p) ?")
+	done
+	subject="${$(< "${patchdir}/msg-clean")[(f)1]}"
+	if [[ -f "${patchdir}/original-commit" ]]; then
+	    git_patches_applied+=("$(< ${patchdir}/original-commit) $subject")
+	else
+	    git_patches_applied+=("? $subject")
+	fi
+	git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
     fi
-    git_patches_unapplied=($(seq $cur $(< "${patchdir}/last")))
 
     VCS_INFO_git_handle_patches
 elif [[ -f "${gitdir}/MERGE_HEAD" ]]; then
-- 
2.5.3.dirty


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
  2015-09-23 18:55 [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean} Daniel Hahler
@ 2015-09-28  1:34 ` Daniel Shahaf
  2015-09-28 18:05   ` Frank Terbeck
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2015-09-28  1:34 UTC (permalink / raw)
  To: Daniel Hahler; +Cc: zsh-workers

Daniel Hahler wrote on Wed, Sep 23, 2015 at 20:55:40 +0200:
> From: Daniel Hahler <git@thequod.de>
> 
> When pressing Ctrl-C after `git am`, only `last` exists in
> `.git/rebase-apply/`, which is empty.
> 
> This patch fixes it to fall back to "no patch applied" then.

What needs to happen before this can be pushed?

I've reproduced the problem and confirm the fix works.

Cheers,

Daniel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
  2015-09-28  1:34 ` Daniel Shahaf
@ 2015-09-28 18:05   ` Frank Terbeck
  2015-09-28 20:53     ` Daniel Hahler
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Terbeck @ 2015-09-28 18:05 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Daniel Hahler, zsh-workers

Hey,

Daniel Shahaf wrote:
[...]
> What needs to happen before this can be pushed?
>
> I've reproduced the problem and confirm the fix works.

I've pushed this right now. I thought the other Daniel would have pushed
this himself. Sorry for the delay. :)

Thanks for testing to you and to Daniel Hahler for coming up with the
fix in the first place.


Regards, Frank


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean}
  2015-09-28 18:05   ` Frank Terbeck
@ 2015-09-28 20:53     ` Daniel Hahler
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Hahler @ 2015-09-28 20:53 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28.09.2015 20:05, Frank Terbeck wrote:
> Hey,
> 
> Daniel Shahaf wrote:
> [...]
>> What needs to happen before this can be pushed?
>>
>> I've reproduced the problem and confirm the fix works.
> 
> I've pushed this right now. I thought the other Daniel would have pushed
> this himself. Sorry for the delay. :)
> 
> Thanks for testing to you and to Daniel Hahler for coming up with the
> fix in the first place.

Thanks for reviewing and pushing it.

I wanted to wait for feedback (or silence) before pushing it myself.


Cheers,
Daniel.
-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAlYJqLkACgkQfAK/hT/mPgAhaACglo5avd/QQYdXlwBrM1YPgR6/
ivwAn2oZ2HJ4QxF1J4J+7i55LqeJCTIv
=EZC+
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-09-28 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-23 18:55 [PATCH] vcs_info: handle missing .git/rebase-apply/{next,msg-clean} Daniel Hahler
2015-09-28  1:34 ` Daniel Shahaf
2015-09-28 18:05   ` Frank Terbeck
2015-09-28 20:53     ` Daniel Hahler

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).