Git development
 help / color / mirror / Atom feed
* [PATCH 2/2] shallow: Remove unused code
@ 2014-01-06  0:00 Ramsay Jones
  2014-01-06  0:08 ` Duy Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2014-01-06  0:00 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, GIT Mailing-list


Commit 58babfff ("shallow.c: the 8 steps to select new commits for
.git/shallow", 05-12-2013) added a function to implement step 5 of
the quoted eight steps, namely 'remove_nonexistent_ours_in_pack()'.
This function implements an optional optimization step in the new
shallow commit selection algorithm. However, this function has no
callers. (The commented out call sites would need to change, in
order to provide information required by the function.)

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Hi Junio,

This should, perhaps, be marked as RFC; if the patch to actually
use this function is coming soon, then this is not needed.
However, I suspect it could be slow in coming ... :-P

ATB,
Ramsay Jones

 builtin/receive-pack.c |  1 -
 commit.h               |  2 --
 fetch-pack.c           |  1 -
 shallow.c              | 16 ----------------
 4 files changed, 20 deletions(-)

diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index de869b5..85bba35 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1059,7 +1059,6 @@ static void update_shallow_info(struct command *commands,
 	struct command *cmd;
 	int *ref_status;
 	remove_nonexistent_theirs_shallow(si);
-	/* XXX remove_nonexistent_ours_in_pack() */
 	if (!si->nr_ours && !si->nr_theirs) {
 		shallow_update = 0;
 		return;
diff --git a/commit.h b/commit.h
index 5507460..30598c6 100644
--- a/commit.h
+++ b/commit.h
@@ -230,8 +230,6 @@ struct shallow_info {
 extern void prepare_shallow_info(struct shallow_info *, struct sha1_array *);
 extern void clear_shallow_info(struct shallow_info *);
 extern void remove_nonexistent_theirs_shallow(struct shallow_info *);
-extern void remove_nonexistent_ours_in_pack(struct shallow_info *,
-					    struct packed_git *);
 extern void assign_shallow_commits_to_refs(struct shallow_info *info,
 					   uint32_t **used,
 					   int *ref_status);
diff --git a/fetch-pack.c b/fetch-pack.c
index 1d0328d..d52de74 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -984,7 +984,6 @@ static void update_shallow(struct fetch_pack_args *args,
 		return;
 
 	remove_nonexistent_theirs_shallow(si);
-	/* XXX remove_nonexistent_ours_in_pack() */
 	if (!si->nr_ours && !si->nr_theirs)
 		return;
 	for (i = 0; i < nr_sought; i++)
diff --git a/shallow.c b/shallow.c
index f48f732..bbc98b5 100644
--- a/shallow.c
+++ b/shallow.c
@@ -358,22 +358,6 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
 	info->nr_theirs = dst;
 }
 
-/* Step 5, remove non-existent ones in "ours" in the pack */
-void remove_nonexistent_ours_in_pack(struct shallow_info *info,
-				     struct packed_git *p)
-{
-	unsigned char (*sha1)[20] = info->shallow->sha1;
-	int i, dst;
-	trace_printf_key(TRACE_KEY, "shallow: remove_nonexistent_ours_in_pack\n");
-	for (i = dst = 0; i < info->nr_ours; i++) {
-		if (i != dst)
-			info->ours[dst] = info->ours[i];
-		if (find_pack_entry_one(sha1[info->ours[i]], p))
-			dst++;
-	}
-	info->nr_ours = dst;
-}
-
 define_commit_slab(ref_bitmap, uint32_t *);
 
 struct paint_info {
-- 
1.8.5

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

* Re: [PATCH 2/2] shallow: Remove unused code
  2014-01-06  0:00 [PATCH 2/2] shallow: Remove unused code Ramsay Jones
@ 2014-01-06  0:08 ` Duy Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Duy Nguyen @ 2014-01-06  0:08 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

On Mon, Jan 6, 2014 at 7:00 AM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:
>
> Commit 58babfff ("shallow.c: the 8 steps to select new commits for
> .git/shallow", 05-12-2013) added a function to implement step 5 of
> the quoted eight steps, namely 'remove_nonexistent_ours_in_pack()'.
> This function implements an optional optimization step in the new
> shallow commit selection algorithm. However, this function has no
> callers. (The commented out call sites would need to change, in
> order to provide information required by the function.)
>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> ---
>
> Hi Junio,
>
> This should, perhaps, be marked as RFC; if the patch to actually
> use this function is coming soon, then this is not needed.
> However, I suspect it could be slow in coming ... :-P

I'm not against this patch. I think the function is to demonstrate
what step 5 is, which is already in the history (unless there are
major errors that I'll need to resend the whole series). I may do the
real step 5 differently anyway to fit better how index-pack and
unpack-objects are run. Not fully realized yet.

>
> ATB,
> Ramsay Jones
>
>  builtin/receive-pack.c |  1 -
>  commit.h               |  2 --
>  fetch-pack.c           |  1 -
>  shallow.c              | 16 ----------------
>  4 files changed, 20 deletions(-)
>
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index de869b5..85bba35 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -1059,7 +1059,6 @@ static void update_shallow_info(struct command *commands,
>         struct command *cmd;
>         int *ref_status;
>         remove_nonexistent_theirs_shallow(si);
> -       /* XXX remove_nonexistent_ours_in_pack() */
>         if (!si->nr_ours && !si->nr_theirs) {
>                 shallow_update = 0;
>                 return;
> diff --git a/commit.h b/commit.h
> index 5507460..30598c6 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -230,8 +230,6 @@ struct shallow_info {
>  extern void prepare_shallow_info(struct shallow_info *, struct sha1_array *);
>  extern void clear_shallow_info(struct shallow_info *);
>  extern void remove_nonexistent_theirs_shallow(struct shallow_info *);
> -extern void remove_nonexistent_ours_in_pack(struct shallow_info *,
> -                                           struct packed_git *);
>  extern void assign_shallow_commits_to_refs(struct shallow_info *info,
>                                            uint32_t **used,
>                                            int *ref_status);
> diff --git a/fetch-pack.c b/fetch-pack.c
> index 1d0328d..d52de74 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -984,7 +984,6 @@ static void update_shallow(struct fetch_pack_args *args,
>                 return;
>
>         remove_nonexistent_theirs_shallow(si);
> -       /* XXX remove_nonexistent_ours_in_pack() */
>         if (!si->nr_ours && !si->nr_theirs)
>                 return;
>         for (i = 0; i < nr_sought; i++)
> diff --git a/shallow.c b/shallow.c
> index f48f732..bbc98b5 100644
> --- a/shallow.c
> +++ b/shallow.c
> @@ -358,22 +358,6 @@ void remove_nonexistent_theirs_shallow(struct shallow_info *info)
>         info->nr_theirs = dst;
>  }
>
> -/* Step 5, remove non-existent ones in "ours" in the pack */
> -void remove_nonexistent_ours_in_pack(struct shallow_info *info,
> -                                    struct packed_git *p)
> -{
> -       unsigned char (*sha1)[20] = info->shallow->sha1;
> -       int i, dst;
> -       trace_printf_key(TRACE_KEY, "shallow: remove_nonexistent_ours_in_pack\n");
> -       for (i = dst = 0; i < info->nr_ours; i++) {
> -               if (i != dst)
> -                       info->ours[dst] = info->ours[i];
> -               if (find_pack_entry_one(sha1[info->ours[i]], p))
> -                       dst++;
> -       }
> -       info->nr_ours = dst;
> -}
> -
>  define_commit_slab(ref_bitmap, uint32_t *);
>
>  struct paint_info {
> --
> 1.8.5



-- 
Duy

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

end of thread, other threads:[~2014-01-06  0:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-06  0:00 [PATCH 2/2] shallow: Remove unused code Ramsay Jones
2014-01-06  0:08 ` Duy Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox