From 70208eb33a783579e528b8491166dc9d593153d1 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Wed, 12 Jun 2013 16:29:02 -0400 Subject: [PATCH 1/2] git prompt: Fix hang on detached head. $git_dir was never set in __fish_git_prompt_current_branch, but used in the case of a detached HEAD. This caused `cut -c1-7 $git_dir/HEAD` to expand to `cut -c1-7` which then waited for input. --- share/functions/__fish_git_prompt.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_git_prompt.fish b/share/functions/__fish_git_prompt.fish index b72352ed4..5c528beae 100644 --- a/share/functions/__fish_git_prompt.fish +++ b/share/functions/__fish_git_prompt.fish @@ -209,7 +209,7 @@ function __fish_git_prompt --description "Prompt function for Git" test -n "$git_dir"; or return set -l r (__fish_git_prompt_current_operation $git_dir) - set -l b (__fish_git_prompt_current_branch) + set -l b (__fish_git_prompt_current_branch $git_dir) set -l w #dirty working directory set -l i #staged changes set -l s #stashes @@ -322,6 +322,7 @@ function __fish_git_prompt_current_branch_bare --description "__fish_git_prompt end function __fish_git_prompt_current_branch --description "__fish_git_prompt helper, returns the current Git branch" + set -l git_dir $argv[1] set -l branch set -l os From 5d75ee7721d9bd09e38375caa3ab2394246c0f3d Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 16 Jun 2013 02:53:14 -0700 Subject: [PATCH 2/2] Mark jobs as completed when all processes have finished, not just the last one. Fixes https://github.com/fish-shell/fish-shell/issues/876 , and coincidentally also https://github.com/fish-shell/fish-shell/issues/848 --- proc.cpp | 18 +++++++++++------- proc.h | 2 +- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/proc.cpp b/proc.cpp index 749f38c2c..d0412414b 100644 --- a/proc.cpp +++ b/proc.cpp @@ -296,15 +296,19 @@ int job_is_stopped(const job_t *j) \param j the job to test */ -int job_is_completed(const job_t *j) +bool job_is_completed(const job_t *j) { - process_t *p; assert(j->first_process != NULL); - for (p = j->first_process; p->next; p = p->next) - ; - - return p->completed; - + bool result = true; + for (process_t *p = j->first_process; p != NULL; p = p->next) + { + if (! p->completed) + { + result = false; + break; + } + } + return result; } void job_set_flag(job_t *j, unsigned int flag, int set) diff --git a/proc.h b/proc.h index b320a49af..163831116 100644 --- a/proc.h +++ b/proc.h @@ -507,7 +507,7 @@ int job_is_stopped(const job_t *j); /** Tests if the job has completed, i.e. if the last process of the pipeline has ended. */ -int job_is_completed(const job_t *j); +bool job_is_completed(const job_t *j); /** Reassume a (possibly) stopped job. Put job j in the foreground. If