Re: [PATCH v7 20/22] commit-graph: add '--reachable' option

2018-09-11 Thread Christian Couder
On Tue, Sep 11, 2018 at 1:19 PM, Derrick Stolee  wrote:
> On 9/11/2018 1:22 AM, Christian Couder wrote:

>> It would be nice if the "Future Work" section of
>> Documentation/technical/commit-graph.txt had something about
>> integration with 'git gc'.
>
> I'm a bit confused about this statement, because at the point in time of
> this patch we had a spot in the "Future Work" section about automatically
> updating the graph _somewhere_. The "future integration with 'git gc'" I
> refer to in this patch is implemented in PATCH 21/22. In PATCH 22/22 we
> removed this section from the technical doc:

Yeah, sorry I had not seen PATCH 21/22. I was interested in an update
about the commit graph feature and especially to know if the way to
use it had been simplified in v2.19.0, so I took a look at the
Documentation/technical/commit-graph.txt and
Documentation/git-commit-graph.txt, but I didn't find anything there
except the `--reachable` option. So I thought that integrating with gc
was still something that needed to be worked on.

> Now that this feature is shipped in Git 2.19.0, this no longer belongs in
> "Future Work".

This is great!

It would be nice though to have something in
Documentation/technical/commit-graph.txt and perhaps also
Documentation/git-commit-graph.txt about it, as it is easy to overlook
the gc.writeCommitGraph documentation in Documentation/config.txt.

>> The "EXAMPLES" section still contains:
>>
>> * Write a graph file containing all reachable commits.
>> +
>> 
>> $ git show-ref -s | git commit-graph write --stdin-commits
>> 
>>
>> I wonder if this should have been changed to use `--reachable`.
>>
>> Thanks!
>
> This is a good idea. I can work on that.

Thanks,
Christian.


Re: [PATCH v7 20/22] commit-graph: add '--reachable' option

2018-09-11 Thread Derrick Stolee

On 9/11/2018 1:22 AM, Christian Couder wrote:

On Wed, Jun 27, 2018 at 3:24 PM, Derrick Stolee  wrote:

When writing commit-graph files, it can be convenient to ask for all
reachable commits (starting at the ref set) in the resulting file. This
is particularly helpful when writing to stdin is complicated, such as a
future integration with 'git gc'.

It would be nice if the "Future Work" section of
Documentation/technical/commit-graph.txt had something about
integration with 'git gc'.


Hi Christian,

I'm a bit confused about this statement, because at the point in time of 
this patch we had a spot in the "Future Work" section about 
automatically updating the graph _somewhere_. The "future integration 
with 'git gc'" I refer to in this patch is implemented in PATCH 21/22. 
In PATCH 22/22 we removed this section from the technical doc:


-
-- The current design uses the 'commit-graph' subcommand to generate the graph.
-  When this feature stabilizes enough to recommend to most users, we should
-  add automatic graph writes to common operations that create many commits.
-  For example, one could compute a graph on 'clone', 'fetch', or 'repack'
-  commands.
-

Now that this feature is shipped in Git 2.19.0, this no longer belongs 
in "Future Work".



  With the `--stdin-commits` option, generate the new commit graph by
  walking commits starting at the commits specified in stdin as a list
  of OIDs in hex, one OID per line. (Cannot be combined with
---stdin-packs.)
+`--stdin-packs` or `--reachable`.)
++
+With the `--reachable` option, generate the new commit graph by walking
+commits starting at all refs. (Cannot be combined with `--stdin-commits`
+or `--stdin-packs`.)
  +
  With the `--append` option, include all commits that are present in the
  existing commit-graph file.

The "EXAMPLES" section still contains:

* Write a graph file containing all reachable commits.
+

$ git show-ref -s | git commit-graph write --stdin-commits


I wonder if this should have been changed to use `--reachable`.

Thanks!

This is a good idea. I can work on that.

Thanks,
-Stolee


Re: [PATCH v7 20/22] commit-graph: add '--reachable' option

2018-09-10 Thread Christian Couder
On Wed, Jun 27, 2018 at 3:24 PM, Derrick Stolee  wrote:
> When writing commit-graph files, it can be convenient to ask for all
> reachable commits (starting at the ref set) in the resulting file. This
> is particularly helpful when writing to stdin is complicated, such as a
> future integration with 'git gc'.

It would be nice if the "Future Work" section of
Documentation/technical/commit-graph.txt had something about
integration with 'git gc'.

>  With the `--stdin-commits` option, generate the new commit graph by
>  walking commits starting at the commits specified in stdin as a list
>  of OIDs in hex, one OID per line. (Cannot be combined with
> ---stdin-packs.)
> +`--stdin-packs` or `--reachable`.)
> ++
> +With the `--reachable` option, generate the new commit graph by walking
> +commits starting at all refs. (Cannot be combined with `--stdin-commits`
> +or `--stdin-packs`.)
>  +
>  With the `--append` option, include all commits that are present in the
>  existing commit-graph file.

The "EXAMPLES" section still contains:

* Write a graph file containing all reachable commits.
+

$ git show-ref -s | git commit-graph write --stdin-commits


I wonder if this should have been changed to use `--reachable`.

Thanks!


Re: [PATCH v7 20/22] commit-graph: add '--reachable' option

2018-06-27 Thread Junio C Hamano
Derrick Stolee  writes:

> diff --git a/commit-graph.c b/commit-graph.c
> index a06e7e9549..adf54e3fe7 100644
> --- a/commit-graph.c
> +++ b/commit-graph.c
> @@ -7,6 +7,7 @@
>  #include "packfile.h"
>  #include "commit.h"
>  #include "object.h"
> +#include "refs.h"
>  #include "revision.h"
>  #include "sha1-lookup.h"
>  #include "commit-graph.h"
> @@ -656,6 +657,23 @@ static void compute_generation_numbers(struct 
> packed_commit_list* commits)
>   }
>  }
>  
> +static int add_ref_to_list(const char *refname,
> +const struct object_id *oid,
> +int flags, void *cb_data)
> +{
> + struct string_list *list = (struct string_list*)cb_data;

Style: "(struct string_list *)cb_data"

Also please have a blank line here between the decls and the first
statement.

> + string_list_append(list, oid_to_hex(oid));
> + return 0;
> +}