git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Add --ignore-missing to git-pack-objects?
@ 2017-08-14 22:51 ch
  2017-08-20 10:16 ` Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: ch @ 2017-08-14 22:51 UTC (permalink / raw)
  To: git

Hi.

Is it possible to add an option akin to git-rev-list's '--ignore-missing' to
git-pack-objects?

I use git bundles to (incrementally) backup my repositories. My script inspects
all bundles in the backup and passes their contained refs as excludes to
git-pack-objects to build the pack for the new bundle. This works fine as long
as none of these refs have been garbage-collected in the source repository.
Something like '--ignore-missing' would be really handy here to ask
git-pack-objects to simply ignore any of the passed revs that are not present
(anymore).

Thanks in advance.

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

* Re: Add --ignore-missing to git-pack-objects?
  2017-08-14 22:51 Add --ignore-missing to git-pack-objects? ch
@ 2017-08-20 10:16 ` Jeff King
  2017-08-20 16:05   ` ch
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff King @ 2017-08-20 10:16 UTC (permalink / raw)
  To: ch; +Cc: git

On Tue, Aug 15, 2017 at 12:51:01AM +0200, ch wrote:

> Is it possible to add an option akin to git-rev-list's '--ignore-missing' to
> git-pack-objects?
> 
> I use git bundles to (incrementally) backup my repositories. My script inspects
> all bundles in the backup and passes their contained refs as excludes to
> git-pack-objects to build the pack for the new bundle. This works fine as long
> as none of these refs have been garbage-collected in the source repository.
> Something like '--ignore-missing' would be really handy here to ask
> git-pack-objects to simply ignore any of the passed revs that are not present
> (anymore).

So if I understand correctly, you are only using these for the negative
side of the traversal? rev-list should ignore missing objects in such a
case even without --ignore-missing, and I think it may simply be a bug
if pack-objects is not.

Do you have a simple reproduction recipe?

-Peff

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

* Re: Add --ignore-missing to git-pack-objects?
  2017-08-20 10:16 ` Jeff King
@ 2017-08-20 16:05   ` ch
  0 siblings, 0 replies; 3+ messages in thread
From: ch @ 2017-08-20 16:05 UTC (permalink / raw)
  To: Jeff King; +Cc: git

Hi Jeff.

Thanks a lot for your response.

Jeff King wrote:

> So if I understand correctly, you are only using these for the negative
> side of the traversal?

Yes.

Jeff King wrote:

> rev-list should ignore missing objects in such a
> case even without --ignore-missing, and I think it may simply be a bug
> if pack-objects is not.
> 
> Do you have a simple reproduction recipe?

Here's a small bash script to illustrate the core issue:

----
add_file()
{
     echo "$1" > "$1"
     git add "$1"
     git commit -m "$1"
}

git init .
git config core.logAllRefUpdates false

add_file "test-1"
add_file "test-2"

git checkout -b feature

add_file "test-3"
add_file "test-4"

git checkout master

add_file "test-5"
add_file "test-6"

feature_tip=$(git rev-list -1 feature)

echo -e "\nDeleting branch 'feature' ($feature_tip)..."
git branch -D feature
git gc --prune=now

echo -e "\nCalling git-pack-objects with (now deleted) ^$feature_tip..."
git pack-objects --all --revs --stdout --thin --delta-base-offset --all-progress-implied <<< ^$feature_tip > pack

echo -e "\nCalling git-rev-list with (now deleted) ^$feature_tip..."
git rev-list --all ^$feature_tip

echo -e "\nCalling git-rev-list --ignore-missing with (now deleted) ^$feature_tip..."
git rev-list --all --ignore-missing ^$feature_tip
----

Both, git-pack-objects and git-rev-list (without --ignore-missing) fail with

fatal: bad object <feature_tip>

on git version 2.14.1.windows.1.

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

end of thread, other threads:[~2017-08-20 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-14 22:51 Add --ignore-missing to git-pack-objects? ch
2017-08-20 10:16 ` Jeff King
2017-08-20 16:05   ` ch

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).