* [PATCH 0/4] add write-tree --missing OK, fix cogito -N options
@ 2005-07-11 3:53 Bryan Larsen
2005-07-11 3:53 ` [PATCH 1/4] bugfix for cg-init: ARGV Bryan Larsen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Bryan Larsen @ 2005-07-11 3:53 UTC (permalink / raw
To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git
All of my patches have been applied to git and cogito except for the
first one, the patch that adds the --no-check option to
git-write-tree. This is problematic because one of the patches that
Petr applied to cogito requires git-write-tree --no-check.
As well, there are two bugs in cg-init: the one that Joel Becker
found, plus the -N option needs to be passed to cg-commit.
Finally, Junio suggested that the --no-check option be renamed to
--missing-ok.
These patches fix the situation up.
1/4: bugfix for cg-init ARGV
2/4: bugfix for cg-init.
3/4: add --missing-ok option to git-write-tree.
4/4: change cg-commit to use --missing-ok instead of --no-check.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] bugfix for cg-init: ARGV
2005-07-11 3:53 [PATCH 0/4] add write-tree --missing OK, fix cogito -N options Bryan Larsen
@ 2005-07-11 3:53 ` Bryan Larsen
2005-07-11 3:53 ` [PATCH 2/4] bugfix for cg-init -N: pass -N to cg-commit Bryan Larsen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Bryan Larsen @ 2005-07-11 3:53 UTC (permalink / raw
To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git
Bugfix: nasty typo (ARGV instead of ARGS) in my last patch to cg-init.
Signed off by: Bryan Larsen <bryan.larsen@gmail.com>
---
diff --git a/cg-init b/cg-init
--- a/cg-init
+++ b/cg-init
@@ -33,7 +33,7 @@ while optparse; do
fi
done
-uri=$ARGV
+uri=$ARGS
[ -e $_git ] && die "$_git already exists"
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] bugfix for cg-init -N: pass -N to cg-commit
2005-07-11 3:53 [PATCH 0/4] add write-tree --missing OK, fix cogito -N options Bryan Larsen
2005-07-11 3:53 ` [PATCH 1/4] bugfix for cg-init: ARGV Bryan Larsen
@ 2005-07-11 3:53 ` Bryan Larsen
2005-07-11 3:53 ` [PATCH 3/4] add --missing-ok option to write-tree Bryan Larsen
2005-07-11 3:53 ` [PATCH 4/4] switch cg-commit -N to use --missing-ok instead of --no-check Bryan Larsen
3 siblings, 0 replies; 5+ messages in thread
From: Bryan Larsen @ 2005-07-11 3:53 UTC (permalink / raw
To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git
Bugfix for cg-init -N: the -N option needs to be passed down into cg-commit as well.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---
diff --git a/cg-init b/cg-init
--- a/cg-init
+++ b/cg-init
@@ -56,7 +56,7 @@ if [ "$uri" ]; then
else
git-read-tree # Seed the dircache
find * \( -type f -o -type l \) -print0 | xargs -0r cg-add ${infoonly}
- cg-commit -C -m"Initial commit" -E
+ cg-commit -C -m"Initial commit" -E ${infoonly}
fi
trap "" SIGTERM EXIT
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] add --missing-ok option to write-tree
2005-07-11 3:53 [PATCH 0/4] add write-tree --missing OK, fix cogito -N options Bryan Larsen
2005-07-11 3:53 ` [PATCH 1/4] bugfix for cg-init: ARGV Bryan Larsen
2005-07-11 3:53 ` [PATCH 2/4] bugfix for cg-init -N: pass -N to cg-commit Bryan Larsen
@ 2005-07-11 3:53 ` Bryan Larsen
2005-07-11 3:53 ` [PATCH 4/4] switch cg-commit -N to use --missing-ok instead of --no-check Bryan Larsen
3 siblings, 0 replies; 5+ messages in thread
From: Bryan Larsen @ 2005-07-11 3:53 UTC (permalink / raw
To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git
Add --missing-ok option to git-write.tree. This option allows a write-tree even if the referenced objects are not in the database.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---
diff --git a/Documentation/git-write-tree.txt b/Documentation/git-write-tree.txt
--- a/Documentation/git-write-tree.txt
+++ b/Documentation/git-write-tree.txt
@@ -10,6 +10,7 @@ git-write-tree - Creates a tree from the
SYNOPSIS
--------
'git-write-tree'
+ [--missing-ok]
DESCRIPTION
-----------
@@ -23,7 +24,11 @@ In order to have that match what is actu
now, you need to have done a "git-update-cache" phase before you did the
"git-write-tree".
-
+OPTIONS
+-------
+--missing-ok::
+ Normally "git-write-tree" ensures that the objects referenced by the
+ directory exist in the object database. This option disables this check.
////////////////////////////////////////////////////////////////
diff --git a/write-tree.c b/write-tree.c
--- a/write-tree.c
+++ b/write-tree.c
@@ -5,6 +5,8 @@
*/
#include "cache.h"
+static int missing_ok = 0;
+
static int check_valid_sha1(unsigned char *sha1)
{
int ret;
@@ -61,7 +63,7 @@ static int write_tree(struct cache_entry
sha1 = subdir_sha1;
}
- if (check_valid_sha1(sha1) < 0)
+ if (!missing_ok && check_valid_sha1(sha1) < 0)
exit(1);
entrylen = pathlen - baselen;
@@ -86,6 +88,16 @@ int main(int argc, char **argv)
int i, funny;
int entries = read_cache();
unsigned char sha1[20];
+
+ if (argc==2) {
+ if (!strcmp(argv[1], "--missing-ok"))
+ missing_ok = 1;
+ else
+ die("unknown option %s", argv[1]);
+ }
+
+ if (argc>2)
+ die("too many options");
if (entries < 0)
die("git-write-tree: error reading cache");
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] switch cg-commit -N to use --missing-ok instead of --no-check
2005-07-11 3:53 [PATCH 0/4] add write-tree --missing OK, fix cogito -N options Bryan Larsen
` (2 preceding siblings ...)
2005-07-11 3:53 ` [PATCH 3/4] add --missing-ok option to write-tree Bryan Larsen
@ 2005-07-11 3:53 ` Bryan Larsen
3 siblings, 0 replies; 5+ messages in thread
From: Bryan Larsen @ 2005-07-11 3:53 UTC (permalink / raw
To: bryan.larsen; +Cc: junkio, torvalds, Bryan Larsen, pasky, git
Make cg-commit aware of the rename of git-write-tree --no-check to --missing-ok.
Signed-off-by: Bryan Larsen <bryan.larsen@gmail.com>
---
diff --git a/cg-commit b/cg-commit
--- a/cg-commit
+++ b/cg-commit
@@ -111,13 +111,13 @@ forceeditor=
ignorecache=
infoonly=
commitalways=
-nocheck=
+missingok=
msgs=()
while optparse; do
if optparse -C; then
ignorecache=1
elif optparse -N; then
- nocheck=--no-check
+ missingok=--missing-ok
infoonly=--info-only
elif optparse -e; then
forceeditor=1
@@ -311,7 +311,7 @@ if [ -s "$_git/HEAD" ]; then
oldheadstr="-p $oldhead"
fi
-treeid=$(git-write-tree ${nocheck})
+treeid=$(git-write-tree ${missingok})
[ "$treeid" ] || die "git-write-tree failed"
if [ ! "$force" ] && [ ! "$merging" ] && [ "$oldhead" ] &&
[ "$treeid" = "$(tree-id)" ]; then
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-07-11 3:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 3:53 [PATCH 0/4] add write-tree --missing OK, fix cogito -N options Bryan Larsen
2005-07-11 3:53 ` [PATCH 1/4] bugfix for cg-init: ARGV Bryan Larsen
2005-07-11 3:53 ` [PATCH 2/4] bugfix for cg-init -N: pass -N to cg-commit Bryan Larsen
2005-07-11 3:53 ` [PATCH 3/4] add --missing-ok option to write-tree Bryan Larsen
2005-07-11 3:53 ` [PATCH 4/4] switch cg-commit -N to use --missing-ok instead of --no-check Bryan Larsen
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).