threads / patch / 45071

patchrev-list-options.txt: update --all about detached HEAD

Subject: [PATCH] rev-list-options.txt: update --all about detached HEAD

## tl;dr

4 messages between Feb 7, 2017 and Feb 8, 2017. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Nguyễn Thái Ngọc Duy· Feb 7, 2017, 13:38 UTC · lore

This is the document patch for f0298cf1c6 (revision walker: include a detached HEAD in --all - 2009-01-16)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 Documentation/rev-list-options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to Documentation/rev-list-options.txt +2 −2
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 5da7cf5a8d..72212ac6ec 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -133,8 +133,8 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
 	for all following revision specifiers, up to the next `--not`.
 
 --all::
-	Pretend as if all the refs in `refs/` are listed on the
-	command line as '<commit>'.
+	Pretend as if all the refs in `refs/` (and HEAD if detached)
+	are listed on the command line as '<commit>'.
 
 --branches[=<pattern>]::
 	Pretend as if all the refs in `refs/heads` are listed
-- 
2.11.0.157.gd943d85
Jeff King· Feb 7, 2017, 19:42 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH] rev-list-options.txt: update --all about detached HEAD

On Tue, Feb 07, 2017 at 08:38:49PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 8 quoted lines
> This is the document patch for f0298cf1c6 (revision walker: include a
> detached HEAD in --all - 2009-01-16)
> [...]
>  --all::
> -	Pretend as if all the refs in `refs/` are listed on the
> -	command line as '<commit>'.
> +	Pretend as if all the refs in `refs/` (and HEAD if detached)
> +	are listed on the command line as '<commit>'.

I think this is an improvement, but I'm not sure about the "if detached" bit. We always read HEAD, no matter what.

If you only care about reachability, then reading HEAD only has an impact if it is detached, since otherwise we know that we will grab the ref via refs/.

I'm not sure if it would matter for some other cases, though. For example, with "--source", do we report HEAD or the matching ref? It looks like the latter (because we read the refs first).

I suspect you could also construct a case with excludes like:
  $ git checkout foo
  $ git rev-list --exclude=refs/heads/foo --all
where it is relevant that we read HEAD separately from refs/heads/foo.
So I think just "and HEAD" is better, like:
  Pretend as if all the refs in `refs/`, along with `HEAD`, are
  listed...
-Peff
Nguyễn Thái Ngọc Duy· Feb 8, 2017, 06:06 UTC · re: Nguyễn Thái Ngọc Duy · lore

[PATCH v2] rev-list-options.txt: update --all about HEAD

This is the document patch for f0298cf1c6 (revision walker: include a detached HEAD in --all - 2009-01-16).

Even though that commit is about detached HEAD, as Jeff pointed out, always adding HEAD in that case may have subtle differences with --source or --exclude. So the document mentions nothing about the detached-ness.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 v2 drops "detached".
 Documentation/rev-list-options.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Show changes to Documentation/rev-list-options.txt +2 −2
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index 5da7cf5a8d..a02f7324c0 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -133,8 +133,8 @@ parents) and `--max-parents=-1` (negative numbers denote no upper limit).
 	for all following revision specifiers, up to the next `--not`.
 
 --all::
-	Pretend as if all the refs in `refs/` are listed on the
-	command line as '<commit>'.
+	Pretend as if all the refs in `refs/`, along with `HEAD`, are
+	listed on the command line as '<commit>'.
 
 --branches[=<pattern>]::
 	Pretend as if all the refs in `refs/heads` are listed
-- 
2.11.0.157.gd943d85
Jeff King· Feb 8, 2017, 23:01 UTC · re: Nguyễn Thái Ngọc Duy · lore

Re: [PATCH v2] rev-list-options.txt: update --all about HEAD

On Wed, Feb 08, 2017 at 01:06:41PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 11 quoted lines
> This is the document patch for f0298cf1c6 (revision walker: include a
> detached HEAD in --all - 2009-01-16).
> 
> Even though that commit is about detached HEAD, as Jeff pointed out,
> always adding HEAD in that case may have subtle differences with
> --source or --exclude. So the document mentions nothing about the
> detached-ness.
> 
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  v2 drops "detached".
Thanks. Seems like an obvious improvement to me.
-Peff

← back to recent threads