[PATCH v2 4/4] Make "git branch -d" prune missing worktrees automatically.

2019-10-18 Thread Peter Jones
meaningfully checked out, the repo's data is just stale and no longer reflects reality. This makes it so that if nothing is present where a worktree is supposedly checked out, deleting the branch will automatically prune it. Signed-off-by: Peter Jones --- builtin/branch.c | 6 +- 1 fi

[PATCH v2 1/4] libgit: Add a read-only helper to test the worktree lock

2019-10-18 Thread Peter Jones
Add the function is_worktree_locked(), which is a helper to tell if a worktree is locked without having to be able to modify it. Signed-off-by: Peter Jones --- builtin/worktree.c | 2 +- worktree.c | 16 worktree.h | 5 + 3 files changed, 22 insertions

[PATCH v2 3/4] Make die_if_checked_out() prune missing checkouts of unlocked worktrees.

2019-10-18 Thread Peter Jones
ingfully checked out, the repo's data is just stale and no longer reflects reality. This makes it so that if nothing is present where a worktree is supposedly checked out, and it is not locked, we ignore that the worktree exists, then it should be cleaned up. Signed-off-by: Peter Jones --- br

[PATCH v2 2/4] libgit: Expose more worktree functionality.

2019-10-18 Thread Peter Jones
Add delete_worktrees_dir_if_empty() and prune_worktree() to the public API, so they can be used from more places. Also add a new function, prune_worktree_if_missing(), which prunes unlocked worktrees if they aren't present on the filesystem. Signed-off-by: Peter Jones --- builtin/workt

Re: [PATCH 2/2] Make "git branch -d" prune missing worktrees automatically.

2019-10-18 Thread Peter Jones
On Thu, Oct 17, 2019 at 06:44:26PM +0200, SZEDER Gábor wrote: > > if (!wt || (ignore_current_worktree && wt->is_current)) > > return; > > + if (access(wt->path, F_OK) < 0 && > > + (errno == ENOENT || errno == ENOTDIR)) > > + return; > > I think this check is insuf

[PATCH 1/2] Make die_if_checked_out() ignore missing worktree checkouts.

2019-10-17 Thread Peter Jones
rom libgit currently.) Signed-off-by: Peter Jones --- branch.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/branch.c b/branch.c index 579494738a7..60322ded953 100644 --- a/branch.c +++ b/branch.c @@ -360,6 +360,9 @@ void die_if_checked_out(const char *branch, int ignor

[PATCH 2/2] Make "git branch -d" prune missing worktrees automatically.

2019-10-17 Thread Peter Jones
meaningfully checked out, the repo's data is just stale and no longer reflects reality. This makes it so that if nothing is present where a worktree is supposedly checked out, deleting the branch will automatically prune it. Signed-off-by: Peter Jones --- builtin/branch.c |

[PATCH] git-am: Handle "git show" output correctly

2012-09-12 Thread Peter Jones
than going back and forth with them to get a "correctly" formatted patch containing exactly the same actual information. Signed-off-by: Peter Jones --- git-am.sh | 57 + 1 file changed, 57 insertions(+) diff --git a/git-am.sh b/git-am.sh

Re: [PATCH] git-am: Handle "git show" output correctly

2012-09-12 Thread Peter Jones
On Wed, 2012-09-12 at 13:06 -0700, Junio C Hamano wrote: > Peter Jones writes: > > > This patch adds the ability for "git am" to accept patches in the format > > generated by "git show". Some people erroneously use "git show" instead > > o

[PATCH] git-am: Handle "git show" output correctly

2012-09-12 Thread Peter Jones
than going back and forth with them to get a "correctly" formatted patch containing exactly the same actual information. Signed-off-by: Peter Jones --- git-am.sh | 60 1 file changed, 60 insertions(+) diff --git a/git-am.sh b/git-am

Re: [PATCH] [git-am] Handle "git show" output correctly

2012-09-12 Thread Peter Jones
On Wed, 2012-09-12 at 10:32 -0700, Junio C Hamano wrote: > We do not want to apply "git show" output that munges the log > message, period. > > If you want to give patches to somebody (or to yourself) via e-mail > or via sneaker-net, "git format-patch" is there for you. Do not > butcher "am" to a

Re: [PATCH] Handle "git show" output correctly.

2012-09-12 Thread Peter Jones
couldn't get it to work if I preserved the newline; for some reason I always get a second newline and that's /more/ wrong. -- Peter >From f7521f88731f9fc696dcd8e32de58cc9d98ed892 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 12 Sep 2012 13:17:11 -0400 Subject: [PATCH

[PATCH] [git-am] Handle "git show" output correctly

2012-09-12 Thread Peter Jones
than going back and forth with them to get a "correctly" formatted patch containing exactly the same actual information. Signed-off-by: Peter Jones --- git-am.sh | 45 + 1 file changed, 45 insertions(+) diff --git a/git-am.sh b/git-am.sh index

[PATCH] Handle "git show" output correctly.

2012-09-12 Thread Peter Jones
(this version with fixed tabs and the comment fixed to be actual English) Signed-off-by: Peter Jones --- git-am.sh | 45 + 1 file changed, 45 insertions(+) diff --git a/git-am.sh b/git-am.sh index c682d34..cfd7b09 100755 --- a/git-am.sh +++ b/git

[PATCH] Handle "git show" output correctly.

2012-09-12 Thread Peter Jones
(this version with fixed tabs) Signed-off-by: Peter Jones --- git-am.sh | 45 + 1 file changed, 45 insertions(+) diff --git a/git-am.sh b/git-am.sh index c682d34..4a1a768 100755 --- a/git-am.sh +++ b/git-am.sh @@ -216,6 +216,21 @@ check_patch_format

[PATCH] Handle "git show" output correctly.

2012-09-12 Thread Peter Jones
Signed-off-by: Peter Jones --- git-am.sh | 46 ++ 1 file changed, 46 insertions(+) diff --git a/git-am.sh b/git-am.sh index c682d34..ebcbff7 100755 --- a/git-am.sh +++ b/git-am.sh @@ -216,6 +216,21 @@ check_patch_format () { read l2