* [PATCH 06/10] rev-list: pass "revs" to "show_bisect_vars"
From: Christian Couder @ 2009-03-26 4:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Tapsell, Johannes Schindelin
instead of using static "revs" data
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
bisect.h | 3 ++-
builtin-rev-list.c | 13 +++++++------
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/bisect.h b/bisect.h
index 860a15c..31c99fe 100644
--- a/bisect.h
+++ b/bisect.h
@@ -5,6 +5,7 @@ extern struct commit_list *find_bisection(struct commit_list *list,
int *reaches, int *all,
int find_all);
-extern int show_bisect_vars(int reaches, int all, int show_all);
+extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,
+ int show_all);
#endif
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index c700c34..cdb0f9d 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -226,16 +226,16 @@ static int estimate_bisect_steps(int all)
return (e < 3 * x) ? n : n - 1;
}
-int show_bisect_vars(int reaches, int all, int show_all)
+int show_bisect_vars(struct rev_info *revs, int reaches, int all, int show_all)
{
int cnt;
char hex[41];
- if (!revs.commits)
+ if (!revs->commits)
return 1;
/*
- * revs.commits can reach "reaches" commits among
+ * revs->commits can reach "reaches" commits among
* "all" commits. If it is good, then there are
* (all-reaches) commits left to be bisected.
* On the other hand, if it is bad, then the set
@@ -247,10 +247,10 @@ int show_bisect_vars(int reaches, int all, int show_all)
if (cnt < reaches)
cnt = reaches;
- strcpy(hex, sha1_to_hex(revs.commits->item->object.sha1));
+ strcpy(hex, sha1_to_hex(revs->commits->item->object.sha1));
if (show_all) {
- traverse_commit_list(&revs, show_commit, show_object);
+ traverse_commit_list(revs, show_commit, show_object);
printf("------\n");
}
@@ -358,7 +358,8 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
revs.commits = find_bisection(revs.commits, &reaches, &all,
bisect_find_all);
if (bisect_show_vars)
- return show_bisect_vars(reaches, all, bisect_find_all);
+ return show_bisect_vars(&revs, reaches, all,
+ bisect_find_all);
}
traverse_commit_list(&revs,
--
1.6.2.1.317.g3d804
^ permalink raw reply related
* [PATCH 07/10] rev-list: call new "filter_skip" function
From: Christian Couder @ 2009-03-26 4:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Tapsell, Johannes Schindelin
This patch implements a new "filter_skip" function in C in
"bisect.c" that will later replace the existing implementation in
shell in "git-bisect.sh".
An array is used to store the skipped commits. But the array is
not yet fed anything.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
bisect.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
bisect.h | 6 ++++-
builtin-rev-list.c | 30 ++++++++++++++++++++----
3 files changed, 95 insertions(+), 6 deletions(-)
diff --git a/bisect.c b/bisect.c
index 27def7d..39189f2 100644
--- a/bisect.c
+++ b/bisect.c
@@ -4,6 +4,11 @@
#include "revision.h"
#include "bisect.h"
+
+static unsigned char (*skipped_sha1)[20];
+static int skipped_sha1_nr;
+static int skipped_sha1_alloc;
+
/* bits #0-15 in revision.h */
#define COUNTED (1u<<16)
@@ -386,3 +391,63 @@ struct commit_list *find_bisection(struct commit_list *list,
return best;
}
+static int skipcmp(const void *a, const void *b)
+{
+ return hashcmp(a, b);
+}
+
+static void prepare_skipped(void)
+{
+ qsort(skipped_sha1, skipped_sha1_nr, sizeof(*skipped_sha1), skipcmp);
+}
+
+static int lookup_skipped(unsigned char *sha1)
+{
+ int lo, hi;
+ lo = 0;
+ hi = skipped_sha1_nr;
+ while (lo < hi) {
+ int mi = (lo + hi) / 2;
+ int cmp = hashcmp(sha1, skipped_sha1[mi]);
+ if (!cmp)
+ return mi;
+ if (cmp < 0)
+ hi = mi;
+ else
+ lo = mi + 1;
+ }
+ return -lo - 1;
+}
+
+struct commit_list *filter_skipped(struct commit_list *list,
+ struct commit_list **tried,
+ int show_all)
+{
+ struct commit_list *filtered = NULL, **f = &filtered;
+
+ *tried = NULL;
+
+ if (!skipped_sha1_nr)
+ return list;
+
+ prepare_skipped();
+
+ while (list) {
+ struct commit_list *next = list->next;
+ list->next = NULL;
+ if (0 <= lookup_skipped(list->item->object.sha1)) {
+ /* Move current to tried list */
+ *tried = list;
+ tried = &list->next;
+ } else {
+ if (!show_all)
+ return list;
+ /* Move current to filtered list */
+ *f = list;
+ f = &list->next;
+ }
+ list = next;
+ }
+
+ return filtered;
+}
diff --git a/bisect.h b/bisect.h
index 31c99fe..2489630 100644
--- a/bisect.h
+++ b/bisect.h
@@ -5,7 +5,11 @@ extern struct commit_list *find_bisection(struct commit_list *list,
int *reaches, int *all,
int find_all);
+extern struct commit_list *filter_skipped(struct commit_list *list,
+ struct commit_list **tried,
+ int show_all);
+
extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,
- int show_all);
+ int show_all, int show_tried);
#endif
diff --git a/builtin-rev-list.c b/builtin-rev-list.c
index cdb0f9d..925d643 100644
--- a/builtin-rev-list.c
+++ b/builtin-rev-list.c
@@ -226,14 +226,28 @@ static int estimate_bisect_steps(int all)
return (e < 3 * x) ? n : n - 1;
}
-int show_bisect_vars(struct rev_info *revs, int reaches, int all, int show_all)
+static void show_tried_revs(struct commit_list *tried)
+{
+ printf("bisect_tried='");
+ for (;tried; tried = tried->next) {
+ char *format = tried->next ? "%s|" : "%s";
+ printf(format, sha1_to_hex(tried->item->object.sha1));
+ }
+ printf("'\n");
+}
+
+int show_bisect_vars(struct rev_info *revs, int reaches, int all,
+ int show_all, int show_tried)
{
int cnt;
- char hex[41];
+ char hex[41] = "";
+ struct commit_list *tried;
- if (!revs->commits)
+ if (!revs->commits && !show_tried)
return 1;
+ revs->commits = filter_skipped(revs->commits, &tried, show_all);
+
/*
* revs->commits can reach "reaches" commits among
* "all" commits. If it is good, then there are
@@ -247,13 +261,16 @@ int show_bisect_vars(struct rev_info *revs, int reaches, int all, int show_all)
if (cnt < reaches)
cnt = reaches;
- strcpy(hex, sha1_to_hex(revs->commits->item->object.sha1));
+ if (revs->commits)
+ strcpy(hex, sha1_to_hex(revs->commits->item->object.sha1));
if (show_all) {
traverse_commit_list(revs, show_commit, show_object);
printf("------\n");
}
+ if (show_tried)
+ show_tried_revs(tried);
printf("bisect_rev=%s\n"
"bisect_nr=%d\n"
"bisect_good=%d\n"
@@ -278,6 +295,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
int bisect_list = 0;
int bisect_show_vars = 0;
int bisect_find_all = 0;
+ int bisect_show_all = 0;
int quiet = 0;
git_config(git_default_config, NULL);
@@ -305,6 +323,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
if (!strcmp(arg, "--bisect-all")) {
bisect_list = 1;
bisect_find_all = 1;
+ bisect_show_all = 1;
revs.show_decorations = 1;
continue;
}
@@ -357,9 +376,10 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
revs.commits = find_bisection(revs.commits, &reaches, &all,
bisect_find_all);
+
if (bisect_show_vars)
return show_bisect_vars(&revs, reaches, all,
- bisect_find_all);
+ bisect_show_all, 0);
}
traverse_commit_list(&revs,
--
1.6.2.1.317.g3d804
^ permalink raw reply related
* [PATCH 09/10] bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES"
From: Christian Couder @ 2009-03-26 4:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Tapsell, Johannes Schindelin
This is needed because "git bisect--helper" must read bisect paths
in "$GIT_DIR/BISECT_NAMES", so that a bisection can be performed only
on commits that touches paths in this file.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
bisect.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/bisect.c b/bisect.c
index ce62696..a6fd826 100644
--- a/bisect.c
+++ b/bisect.c
@@ -4,6 +4,7 @@
#include "revision.h"
#include "refs.h"
#include "list-objects.h"
+#include "quote.h"
#include "bisect.h"
@@ -424,6 +425,33 @@ static int read_bisect_refs(void)
return for_each_bisect_ref(register_ref, NULL);
}
+void read_bisect_paths()
+{
+ struct strbuf str = STRBUF_INIT;
+ const char *filename = git_path("BISECT_NAMES");
+ FILE *fp = fp = fopen(filename, "r");
+
+ if (!fp)
+ die("Could not open file '%s': %s", filename, strerror(errno));
+
+ while (strbuf_getline(&str, fp, '\n') != EOF) {
+ char *quoted, *dequoted;
+ strbuf_trim(&str);
+ quoted = strbuf_detach(&str, NULL);
+ if (!*quoted)
+ continue;
+ dequoted = sq_dequote(quoted);
+ if (!dequoted)
+ die("Badly quoted content in file '%s': %s",
+ filename, quoted);
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = dequoted;
+ }
+
+ strbuf_release(&str);
+ fclose(fp);
+}
+
static int skipcmp(const void *a, const void *b)
{
return hashcmp(a, b);
@@ -485,14 +513,11 @@ struct commit_list *filter_skipped(struct commit_list *list,
return filtered;
}
-int bisect_next_vars(const char *prefix)
+static void bisect_rev_setup(struct rev_info *revs, const char *prefix)
{
- struct rev_info revs;
- int reaches = 0, all = 0;
-
- init_revisions(&revs, prefix);
- revs.abbrev = 0;
- revs.commit_format = CMIT_FMT_UNSPECIFIED;
+ init_revisions(revs, prefix);
+ revs->abbrev = 0;
+ revs->commit_format = CMIT_FMT_UNSPECIFIED;
/* argv[0] will be ignored by setup_revisions */
ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
@@ -504,9 +529,22 @@ int bisect_next_vars(const char *prefix)
ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
rev_argv[rev_argv_nr++] = xstrdup("--");
- setup_revisions(rev_argv_nr, rev_argv, &revs, NULL);
+ read_bisect_paths();
+
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = NULL;
+
+ setup_revisions(rev_argv_nr, rev_argv, revs, NULL);
+
+ revs->limited = 1;
+}
+
+int bisect_next_vars(const char *prefix)
+{
+ struct rev_info revs;
+ int reaches = 0, all = 0;
- revs.limited = 1;
+ bisect_rev_setup(&revs, prefix);
if (prepare_revision_walk(&revs))
die("revision walk setup failed");
--
1.6.2.1.317.g3d804
^ permalink raw reply related
* [PATCH 08/10] bisect--helper: implement "git bisect--helper"
From: Christian Couder @ 2009-03-26 4:55 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Tapsell, Johannes Schindelin
This patch implements a new "git bisect--helper" builtin plumbing
command that will be used to migrate "git-bisect.sh" to C.
We start by implementing only the "--next-vars" option that will
read bisect refs from "refs/bisect/", and then compute the next
bisect step, and output shell variables ready to be eval'ed by
the shell.
At this step, "git bisect--helper" ignores the paths that may
have been put in "$GIT_DIR/BISECT_NAMES". This will be fixed in a
later patch.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
Makefile | 1 +
bisect.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++
bisect.h | 7 +++++
builtin-bisect--helper.c | 27 ++++++++++++++++++
builtin.h | 1 +
git.c | 1 +
6 files changed, 104 insertions(+), 0 deletions(-)
create mode 100644 builtin-bisect--helper.c
diff --git a/Makefile b/Makefile
index 9fa2928..006c27b 100644
--- a/Makefile
+++ b/Makefile
@@ -521,6 +521,7 @@ BUILTIN_OBJS += builtin-add.o
BUILTIN_OBJS += builtin-annotate.o
BUILTIN_OBJS += builtin-apply.o
BUILTIN_OBJS += builtin-archive.o
+BUILTIN_OBJS += builtin-bisect--helper.o
BUILTIN_OBJS += builtin-blame.o
BUILTIN_OBJS += builtin-branch.o
BUILTIN_OBJS += builtin-bundle.o
diff --git a/bisect.c b/bisect.c
index 39189f2..ce62696 100644
--- a/bisect.c
+++ b/bisect.c
@@ -2,6 +2,8 @@
#include "commit.h"
#include "diff.h"
#include "revision.h"
+#include "refs.h"
+#include "list-objects.h"
#include "bisect.h"
@@ -9,6 +11,10 @@ static unsigned char (*skipped_sha1)[20];
static int skipped_sha1_nr;
static int skipped_sha1_alloc;
+static const char **rev_argv;
+static int rev_argv_nr;
+static int rev_argv_alloc;
+
/* bits #0-15 in revision.h */
#define COUNTED (1u<<16)
@@ -391,6 +397,33 @@ struct commit_list *find_bisection(struct commit_list *list,
return best;
}
+static int register_ref(const char *refname, const unsigned char *sha1,
+ int flags, void *cb_data)
+{
+ if (!strcmp(refname, "bad")) {
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = xstrdup(sha1_to_hex(sha1));
+ } else if (!prefixcmp(refname, "good-")) {
+ const char *hex = sha1_to_hex(sha1);
+ char *good = xmalloc(strlen(hex) + 2);
+ *good = '^';
+ memcpy(good + 1, hex, strlen(hex) + 1);
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = good;
+ } else if (!prefixcmp(refname, "skip-")) {
+ ALLOC_GROW(skipped_sha1, skipped_sha1_nr + 1,
+ skipped_sha1_alloc);
+ hashcpy(skipped_sha1[skipped_sha1_nr++], sha1);
+ }
+
+ return 0;
+}
+
+static int read_bisect_refs(void)
+{
+ return for_each_bisect_ref(register_ref, NULL);
+}
+
static int skipcmp(const void *a, const void *b)
{
return hashcmp(a, b);
@@ -451,3 +484,37 @@ struct commit_list *filter_skipped(struct commit_list *list,
return filtered;
}
+
+int bisect_next_vars(const char *prefix)
+{
+ struct rev_info revs;
+ int reaches = 0, all = 0;
+
+ init_revisions(&revs, prefix);
+ revs.abbrev = 0;
+ revs.commit_format = CMIT_FMT_UNSPECIFIED;
+
+ /* argv[0] will be ignored by setup_revisions */
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = xstrdup("bisect_rev_setup");
+
+ if (read_bisect_refs())
+ die("reading bisect refs failed");
+
+ ALLOC_GROW(rev_argv, rev_argv_nr + 1, rev_argv_alloc);
+ rev_argv[rev_argv_nr++] = xstrdup("--");
+
+ setup_revisions(rev_argv_nr, rev_argv, &revs, NULL);
+
+ revs.limited = 1;
+
+ if (prepare_revision_walk(&revs))
+ die("revision walk setup failed");
+ if (revs.tree_objects)
+ mark_edges_uninteresting(revs.commits, &revs, NULL);
+
+ revs.commits = find_bisection(revs.commits, &reaches, &all,
+ !!skipped_sha1_nr);
+
+ return show_bisect_vars(&revs, reaches, all, 0, 1);
+}
diff --git a/bisect.h b/bisect.h
index 2489630..05eea17 100644
--- a/bisect.h
+++ b/bisect.h
@@ -9,7 +9,14 @@ extern struct commit_list *filter_skipped(struct commit_list *list,
struct commit_list **tried,
int show_all);
+/*
+ * The "show_all" parameter should be 0 if this function is called
+ * from outside "builtin-rev-list.c" as otherwise it would use
+ * static "revs" from this file.
+ */
extern int show_bisect_vars(struct rev_info *revs, int reaches, int all,
int show_all, int show_tried);
+extern int bisect_next_vars(const char *prefix);
+
#endif
diff --git a/builtin-bisect--helper.c b/builtin-bisect--helper.c
new file mode 100644
index 0000000..8fe7787
--- /dev/null
+++ b/builtin-bisect--helper.c
@@ -0,0 +1,27 @@
+#include "builtin.h"
+#include "cache.h"
+#include "parse-options.h"
+#include "bisect.h"
+
+static const char * const git_bisect_helper_usage[] = {
+ "git bisect--helper --next-vars",
+ NULL
+};
+
+int cmd_bisect__helper(int argc, const char **argv, const char *prefix)
+{
+ int next_vars = 0;
+ struct option options[] = {
+ OPT_BOOLEAN(0, "next-vars", &next_vars,
+ "output next bisect step variables"),
+ OPT_END()
+ };
+
+ argc = parse_options(argc, argv, options, git_bisect_helper_usage, 0);
+
+ if (!next_vars)
+ usage_with_options(git_bisect_helper_usage, options);
+
+ /* next-vars */
+ return bisect_next_vars(prefix);
+}
diff --git a/builtin.h b/builtin.h
index 1495cf6..425ff8e 100644
--- a/builtin.h
+++ b/builtin.h
@@ -25,6 +25,7 @@ extern int cmd_add(int argc, const char **argv, const char *prefix);
extern int cmd_annotate(int argc, const char **argv, const char *prefix);
extern int cmd_apply(int argc, const char **argv, const char *prefix);
extern int cmd_archive(int argc, const char **argv, const char *prefix);
+extern int cmd_bisect__helper(int argc, const char **argv, const char *prefix);
extern int cmd_blame(int argc, const char **argv, const char *prefix);
extern int cmd_branch(int argc, const char **argv, const char *prefix);
extern int cmd_bundle(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index c2b181e..a553926 100644
--- a/git.c
+++ b/git.c
@@ -271,6 +271,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "annotate", cmd_annotate, RUN_SETUP },
{ "apply", cmd_apply },
{ "archive", cmd_archive },
+ { "bisect--helper", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE },
{ "blame", cmd_blame, RUN_SETUP },
{ "branch", cmd_branch, RUN_SETUP },
{ "bundle", cmd_bundle },
--
1.6.2.1.317.g3d804
^ permalink raw reply related
* Re: Question: Is it possible to host a writable git repo over both http and ssh?
From: Jeff King @ 2009-03-26 4:56 UTC (permalink / raw)
To: Mike Gaffney; +Cc: Shawn O. Pearce, git
In-Reply-To: <49CB0AC1.2070006@gmail.com>
On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote:
> I'm actually trying to take what Sean did with gerrit and extract a
> full Java/MinaSSHD based server that doesn't require a real user
> account and is configurable by spring. So yes, I'm using JGit on the
> server.
Ah. In that case, I don't know whether JGit respects all hooks. You
should ask Shawn (Shawn, we are talking about a post-update to run
update-server-info). :)
-Peff
^ permalink raw reply
* [PATCH 10/10] bisect: use "bisect--helper" and remove "filter_skipped" function
From: Christian Couder @ 2009-03-26 4:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, John Tapsell, Johannes Schindelin
Use the new "git bisect--helper" builtin. It should be faster and
safer instead of the old "filter_skipped" shell function. And it
is a first step to move more shell code to C.
As the output is a little bit different we have to change the code
that interpret the results. But these changes improve code clarity.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
git-bisect.sh | 89 ++++++++-------------------------------------------------
1 files changed, 12 insertions(+), 77 deletions(-)
diff --git a/git-bisect.sh b/git-bisect.sh
index e313bde..0f7590d 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -279,76 +279,13 @@ bisect_auto_next() {
bisect_next_check && bisect_next || :
}
-filter_skipped() {
+eval_and_string_together() {
_eval="$1"
- _skip="$2"
-
- if [ -z "$_skip" ]; then
- eval "$_eval" | {
- while read line
- do
- echo "$line &&"
- done
- echo ':'
- }
- return
- fi
- # Let's parse the output of:
- # "git rev-list --bisect-vars --bisect-all ..."
eval "$_eval" | {
- VARS= FOUND= TRIED=
- while read hash line
+ while read line
do
- case "$VARS,$FOUND,$TRIED,$hash" in
- 1,*,*,*)
- # "bisect_foo=bar" read from rev-list output.
- echo "$hash &&"
- ;;
- ,*,*,---*)
- # Separator
- ;;
- ,,,bisect_rev*)
- # We had nothing to search.
- echo "bisect_rev= &&"
- VARS=1
- ;;
- ,,*,bisect_rev*)
- # We did not find a good bisect rev.
- # This should happen only if the "bad"
- # commit is also a "skip" commit.
- echo "bisect_rev='$TRIED' &&"
- VARS=1
- ;;
- ,,*,*)
- # We are searching.
- TRIED="${TRIED:+$TRIED|}$hash"
- case "$_skip" in
- *$hash*) ;;
- *)
- echo "bisect_rev=$hash &&"
- echo "bisect_tried='$TRIED' &&"
- FOUND=1
- ;;
- esac
- ;;
- ,1,*,bisect_rev*)
- # We have already found a rev to be tested.
- VARS=1
- ;;
- ,1,*,*)
- ;;
- *)
- # Unexpected input
- echo "die 'filter_skipped error'"
- die "filter_skipped error " \
- "VARS: '$VARS' " \
- "FOUND: '$FOUND' " \
- "TRIED: '$TRIED' " \
- "hash: '$hash' " \
- "line: '$line'"
- ;;
- esac
+ echo "$line &&"
done
echo ':'
}
@@ -356,10 +293,12 @@ filter_skipped() {
exit_if_skipped_commits () {
_tried=$1
- if expr "$_tried" : ".*[|].*" > /dev/null ; then
+ _bad=$2
+ if test -n "$_tried" ; then
echo "There are only 'skip'ped commit left to test."
echo "The first bad commit could be any of:"
echo "$_tried" | tr '[|]' '[\012]'
+ test -n "$_bad" && echo "$_bad"
echo "We cannot bisect more!"
exit 2
fi
@@ -490,28 +429,24 @@ bisect_next() {
test "$?" -eq "1" && return
# Get bisection information
- BISECT_OPT=''
- test -n "$skip" && BISECT_OPT='--bisect-all'
- eval="git rev-list --bisect-vars $BISECT_OPT $good $bad --" &&
- eval="$eval $(cat "$GIT_DIR/BISECT_NAMES")" &&
- eval=$(filter_skipped "$eval" "$skip") &&
+ eval="git bisect--helper --next-vars" &&
+ eval=$(eval_and_string_together "$eval") &&
eval "$eval" || exit
if [ -z "$bisect_rev" ]; then
+ # We should exit here only if the "bad"
+ # commit is also a "skip" commit (see above).
+ exit_if_skipped_commits "$bisect_tried"
echo "$bad was both good and bad"
exit 1
fi
if [ "$bisect_rev" = "$bad" ]; then
- exit_if_skipped_commits "$bisect_tried"
+ exit_if_skipped_commits "$bisect_tried" "$bad"
echo "$bisect_rev is first bad commit"
git diff-tree --pretty $bisect_rev
exit 0
fi
- # We should exit here only if the "bad"
- # commit is also a "skip" commit (see above).
- exit_if_skipped_commits "$bisect_rev"
-
bisect_checkout "$bisect_rev" "$bisect_nr revisions left to test after this (roughly $bisect_steps steps)"
}
--
1.6.2.1.317.g3d804
^ permalink raw reply related
* Re: Question: Is it possible to host a writable git repo over both http and ssh?
From: Robin Rosenberg @ 2009-03-26 5:18 UTC (permalink / raw)
To: Jeff King; +Cc: Mike Gaffney, Shawn O. Pearce, git
In-Reply-To: <20090326045650.GA13628@coredump.intra.peff.net>
torsdag 26 mars 2009 05:56:51 skrev Jeff King <peff@peff.net>:
> On Wed, Mar 25, 2009 at 11:55:29PM -0500, Mike Gaffney wrote:
>
> > I'm actually trying to take what Sean did with gerrit and extract a
> > full Java/MinaSSHD based server that doesn't require a real user
> > account and is configurable by spring. So yes, I'm using JGit on the
> > server.
>
> Ah. In that case, I don't know whether JGit respects all hooks. You
> should ask Shawn (Shawn, we are talking about a post-update to run
> update-server-info). :)
Arguably it should. but it doesn't. Then there is a question as to what
format those hooks should be. Shell scripts would run into platform
issues and jgit based stuff should have as little as possible of that, but
a similar mechanism should exist.
-- robin
^ permalink raw reply
* Re: [PATCH 01/10] refs: add "for_each_bisect_ref" function
From: Sverre Rabbelier @ 2009-03-26 6:20 UTC (permalink / raw)
To: Christian Couder; +Cc: Junio C Hamano, git, John Tapsell, Johannes Schindelin
In-Reply-To: <20090326055509.1bc16b28.chriscool@tuxfamily.org>
Heya
On Thu, Mar 26, 2009 at 05:55, Christian Couder <chriscool@tuxfamily.org> wrote:
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
A 10 patches series with no cover letter? And no description of the
individual patches either! C'mon Christian, you know better than that
;).
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Test that every revision builds before pushing changes?
From: Daniel Pittman @ 2009-03-26 6:29 UTC (permalink / raw)
To: git
G'day.
I would like to ensure that my commits are fully bisectable before I
commit them to an upstream repository, at least to the limits of an
automatic tool for testing them.
'git bisect run' is similar: it can automatically locate the breaking in
a test suite, for example, but that doesn't help me in the case of three
commits, A (good), B (bad) and C (good, fixing B).
I would much rather, in this case, use rebase to fix B so that it, too,
builds before I push the changes and pollute a public repository with a
broken changeset — and make bisect that much harder to use in future.
Regards,
Daniel
^ permalink raw reply
* Re: [PATCH 2/2] Add feature release instructions to gitworkflows man page
From: Junio C Hamano @ 2009-03-26 6:48 UTC (permalink / raw)
To: rocketraman; +Cc: git
In-Reply-To: <1238032575-10987-2-git-send-email-rocketraman@fastmail.fm>
rocketraman@fastmail.fm writes:
> +Release Tagging
> +~~~~~~~~~~~~~~~
> +
> +The new feature release is tagged on 'master' with a tag matching
> +vX.Y.Z, where X.Y.Z is the new feature release version.
> +
> +.Release tagging
> +[caption="Recipe: "]
> +==========================================
> +`git tag -s -m GIT "vX.Y.Z" vX.Y.Z`
> +==========================================
I actually always do:
git tag -s -m "GIT X.Y.Z" vX.Y.Z master
The argument to -m in your descriptoin is incorrectly quoted, and has an
extra v. I also spell out 'master' to avoid mistakes, and I would be
happy to encourage others to follow it.
> +Maintenance branch update
> +~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +The current maintenance branch is optionally tracked with the older
> +release version number to allow for further maintenance releases on
> +the older codebase.
> +
> +.Track maint
> +[caption="Recipe: "]
> +=====================================
> +`git branch maint-X.Y.(Z-1) maint`
> +=====================================
This creates maint-X.Y.(Z-1) from maint, but calling this step "track
maint" entirely misses the point.
When people use the word "track", the intention is that they intend to
merge subsequent changes to the original branch (in this case, 'maint') to
the new branch ('maint-X.Y.(Z-1)') from time to time.
That is exactly opposite to what I create maint-X.Y.(Z-1) branch for.
This new "branch to maintain an older codebase" will *never* merge from
'maint' after it forks.
> +Update next branch
> +~~~~~~~~~~~~~~~~~~
> +
> +The 'next' branch may be rebuilt from the tip of 'master' using the
> +surviving topics on 'next'.
> +
> +This step is optional. If it is done by the maintainer, then a public
> +announcement will be made indicating that 'next' was rebased.
The wording I use is more like 'rewound and rebuilt'.
^ permalink raw reply
* Re: [PATCH 07/10] rev-list: call new "filter_skip" function
From: Junio C Hamano @ 2009-03-26 6:49 UTC (permalink / raw)
To: Christian Couder; +Cc: git, John Tapsell, Johannes Schindelin
In-Reply-To: <20090326055549.e1f244d9.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> This patch implements a new "filter_skip" function in C in
> "bisect.c" that will later replace the existing implementation in
> shell in "git-bisect.sh".
>
> An array is used to store the skipped commits. But the array is
> not yet fed anything.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
> bisect.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> bisect.h | 6 ++++-
> builtin-rev-list.c | 30 ++++++++++++++++++++----
> 3 files changed, 95 insertions(+), 6 deletions(-)
>
> diff --git a/bisect.c b/bisect.c
> index 27def7d..39189f2 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -4,6 +4,11 @@
> #include "revision.h"
> #include "bisect.h"
>
> +
> +static unsigned char (*skipped_sha1)[20];
> +static int skipped_sha1_nr;
> +static int skipped_sha1_alloc;
> +
> /* bits #0-15 in revision.h */
>
> #define COUNTED (1u<<16)
> @@ -386,3 +391,63 @@ struct commit_list *find_bisection(struct commit_list *list,
> return best;
> }
>
> +static int skipcmp(const void *a, const void *b)
> +{
> + return hashcmp(a, b);
> +}
I've learned to suspect without reading a qsort() callback that does not
derefence its arguments. Is this doing the right thing?
> +
> +static void prepare_skipped(void)
> +{
> + qsort(skipped_sha1, skipped_sha1_nr, sizeof(*skipped_sha1), skipcmp);
> +}
> +
> +static int lookup_skipped(unsigned char *sha1)
> +{
> + int lo, hi;
> + lo = 0;
> + hi = skipped_sha1_nr;
> + while (lo < hi) {
> + int mi = (lo + hi) / 2;
> + int cmp = hashcmp(sha1, skipped_sha1[mi]);
> + if (!cmp)
> + return mi;
> + if (cmp < 0)
> + hi = mi;
> + else
> + lo = mi + 1;
> + }
> + return -lo - 1;
> +}
^ permalink raw reply
* Re: [PATCH 08/10] bisect--helper: implement "git bisect--helper"
From: Junio C Hamano @ 2009-03-26 6:49 UTC (permalink / raw)
To: Christian Couder; +Cc: git, John Tapsell, Johannes Schindelin
In-Reply-To: <20090326055554.e91bf6ba.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> This patch implements a new "git bisect--helper" builtin plumbing
> command that will be used to migrate "git-bisect.sh" to C.
>
> We start by implementing only the "--next-vars" option that will
> read bisect refs from "refs/bisect/", and then compute the next
> bisect step, and output shell variables ready to be eval'ed by
> the shell.
>
> At this step, "git bisect--helper" ignores the paths that may
> have been put in "$GIT_DIR/BISECT_NAMES". This will be fixed in a
> later patch.
Very nicely done.
> +static int read_bisect_refs(void)
> +{
> + return for_each_bisect_ref(register_ref, NULL);
> +}
This is only a minor point, but I do not foresee anybody other than
bisect--helper (and later bisect) running for_each_bisect_ref(). It might
make sense to redo [01/10] to introduce
for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb)
and change this call site to:
return for_each_ref_in("refs/bisect/", register_ref, NULL);
Needless to say, for_each_{ref,tag_ref,branch_ref,remote_ref}() can be
redefined in terms of for_each_ref_in() so that we can lose these
hardcoded length of prefix strings from the code.
^ permalink raw reply
* Re: [PATCH 09/10] bisect: implement "read_bisect_paths" to read paths in "$GIT_DIR/BISECT_NAMES"
From: Junio C Hamano @ 2009-03-26 6:49 UTC (permalink / raw)
To: Christian Couder; +Cc: git, John Tapsell, Johannes Schindelin
In-Reply-To: <20090326055559.743cb502.chriscool@tuxfamily.org>
Christian Couder <chriscool@tuxfamily.org> writes:
> This is needed because "git bisect--helper" must read bisect paths
> in "$GIT_DIR/BISECT_NAMES", so that a bisection can be performed only
> on commits that touches paths in this file.
>
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Again, very nice.
> bisect.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 files changed, 47 insertions(+), 9 deletions(-)
>
> diff --git a/bisect.c b/bisect.c
> index ce62696..a6fd826 100644
> --- a/bisect.c
> +++ b/bisect.c
> @@ -4,6 +4,7 @@
> #include "revision.h"
> #include "refs.h"
> #include "list-objects.h"
> +#include "quote.h"
> #include "bisect.h"
>
>
> @@ -424,6 +425,33 @@ static int read_bisect_refs(void)
> return for_each_bisect_ref(register_ref, NULL);
> }
>
> +void read_bisect_paths()
> +{
> + struct strbuf str = STRBUF_INIT;
> + const char *filename = git_path("BISECT_NAMES");
> + FILE *fp = fp = fopen(filename, "r");
s/= fp //;
^ permalink raw reply
* Re: Implementing stat() with FindFirstFile()
From: Johannes Sixt @ 2009-03-26 7:15 UTC (permalink / raw)
To: Magnus Bäck; +Cc: git
In-Reply-To: <20090324215416.GB27249@jeeves.jpl.local>
Magnus Bäck schrieb:
> From what I gather the problematic conversion takes place in the Win32
> layer, in which case we might be able to call the ZwQueryDirectoryFile()
> kernel routine directly via ntdll.dll to obtain the file times straight
> from the file system. Has anyone explored that path, and would it be
> acceptable to make such a change?
It depends.
The disadvantages are that this function is only available on Windows XP
and later and that it is not present in the header files of MinGW gcc.
It's on you to prove that there are advantages that clearly outweigh these
disadvantages.
-- Hannes
^ permalink raw reply
* Re: [PATCH] avoid possible overflow in delta size filtering computation
From: Kjetil Barvik @ 2009-03-26 7:18 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Junio C Hamano, git
In-Reply-To: <alpine.LFD.2.00.0903251514360.26337@xanadu.home>
Nicolas Pitre <nico@cam.org> writes:
> On Wed, 25 Mar 2009, Kjetil Barvik wrote:
>
>> Nicolas Pitre <nico@cam.org> writes:
>>
>> > On Wed, 25 Mar 2009, Kjetil Barvik wrote:
>> >
>> >> So, it seems that this patch almost fixed the issue. But notice that
>> >> the pack file was 10 bytes larger for the --depth=95000 case.
>> >>
>> >> I made a small perl script to compare the output from 'git verify-pack
>> >> -v' of the 2 idx/pack files, and found the following difference(1)
>> >> (first line from --depth=20000 case, second from --depth=95000):
>> >>
>> >> fe0a6f3e971373590714dbafd087b235ea60ac00 tree 9 19 18921247 731 96a3ec5789504e6d0f90c99fb1937af1ebd58e2d
>> >> fe0a6f3e971373590714dbafd087b235ea60ac00 tree 20 29 18921247 730 12e560f7fb28558b15e3a2008fba860f9a4b2222
>> >
>> > OK. Apparently, a different base object for that one delta was chosen
>> > between those two runs.
>> >
>> > Is your machine SMP?
>>
>> kjetil ~$ uname -a
>> Linux localhost 2.6.28.4 #26 SMP PREEMPT Tue Feb 10 17:07:14 CET 2009
>> i686 Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz GenuineIntel GNU/Linux
>
> Here you go. If you want a perfectly deterministic repacking, you'll
> have to force the pack.threads config option to 1.
OK, have rerun the test again with pack.config set to 1, and got the
exact same result(1) as above this time also! :-)
And I think I can explain the reason for the same result: When the
--window and/or --depth value(s) is larger than (half?) the value of
possible number of objects (98438 in this time), I think that the
thread logic finds out that it can only run one thread (there is not
room/objects enough for 2 or more threads).
This also explains what I see when I run the repack command (without
the pack.config option), only 1 git process is running on 1 of the
CPU's from the start, and the other is idle.
~~
Give me a hint if you want some debug info from the 2 pack/idx files.
-- kjetil
1) The output from the 2 'git repack' commands did not show the
"running delta with 2 threads" (or something similar) this time.
I guess this is the sign that "pack.threads = 1" is working.
^ permalink raw reply
* [PATCH] documentation: update cvsimport description of "-r" for recent clone
From: Carlo Marcelo Arenas Belon @ 2009-03-26 7:08 UTC (permalink / raw)
To: git; +Cc: Carlo Marcelo Arenas Belon
the "--use-separate-remote" option no longer exists, having since
become the default for a clone.
Signed-off-by: Carlo Marcelo Arenas Belon <carenas@sajinet.com.pe>
---
Documentation/git-cvsimport.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-cvsimport.txt b/Documentation/git-cvsimport.txt
index 3123725..e1fd047 100644
--- a/Documentation/git-cvsimport.txt
+++ b/Documentation/git-cvsimport.txt
@@ -65,7 +65,7 @@ OPTIONS
-r <remote>::
The git remote to import this CVS repository into.
Moves all CVS branches into remotes/<remote>/<branch>
- akin to the 'git-clone' "--use-separate-remote" option.
+ akin to the way 'git-clone' uses 'origin' by default.
-o <branch-for-HEAD>::
When no remote is specified (via -r) the 'HEAD' branch
--
1.6.0.6
^ permalink raw reply related
* Re: [BUG?] How to make a shared/restricted repo?
From: Junio C Hamano @ 2009-03-26 7:23 UTC (permalink / raw)
To: Johan Herland; +Cc: git
In-Reply-To: <200903260122.24770.johan@herland.net>
Johan Herland <johan@herland.net> writes:
> On Thursday 26 March 2009, Junio C Hamano wrote:
>> How about doing it like this, instead?
>
> Looks good, and is obviously much less intrusive than my attempt.
>
> There's still one issue as compared to my series: Hook scripts in
> .git/hooks lose their executable bit when copied from template dir.
> You probably need to do some kind of special x-bit handling, similar
> to what's already done for directories.
>
> Other than that:
> Tested-by: Johan Herland <johan@herland.net>
Sorry to invalidate your Tested-by, but here is a re-roll using a slightly
different strategy.
To fix the loose object codepath, the earlier patch added a call to
adjust_shared_perm() to write_loose_object() function, but after looking
at your 7th patch, I realized that the pattern of file creation inside
$GIT_DIR typically is to first create a temporary file, write to it, and
then finish it off by calling move_temp_to_file(). The true purpose of
the function is to "finalize the file being created", and it is misnamed
in that it describes how its implementation does it currently (i.e. by
renaming the temporary file to its final name), but it makes perfect sense
to call adjust_shared_perm() inside it as a part of finalization. I think
this should cover the codepaths your 7th patch fixed without actually
touching them.
Could you eyeball and re-test it?
-- >8 --
[PATCH] "core.sharedrepository = 0mode" should set, not loosen
This fixes the behaviour of octal notation to how it is defined in the
documentation, while keeping the traditional "loosen only" semantics
intact for "group" and "everybody".
Three main points of this patch are:
- For an explicit octal notation, the internal shared_repository variable
is set to a negative value, so that we can tell "group" (which is to
"OR" in 0660) and 0660 (which is to "SET" to 0660);
- git-init did not set shared_repository variable early enough to affect
the initial creation of many files, notably copied templates and the
configuration. We set it very early when a command-line option
specifies a custom value.
- Many codepaths create files inside $GIT_DIR by various codepaths that
involve mkstemp(), and then call move_temp_to_file() to rename it to
its final destination. We can add adjust_shared_perm() call here; for
the traditional "loosen-only", this would be a no-op for many codepaths
because the mode is already loose enough, but with the new behaviour it
makes a difference.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-init-db.c | 12 ++++++++++--
path.c | 36 +++++++++++++++++++++---------------
setup.c | 4 ++--
sha1_file.c | 8 +++++++-
t/t1301-shared-repo.sh | 37 +++++++++++++++++++++++++++++++++++++
5 files changed, 77 insertions(+), 20 deletions(-)
diff --git a/builtin-init-db.c b/builtin-init-db.c
index ee3911f..8199e5d 100644
--- a/builtin-init-db.c
+++ b/builtin-init-db.c
@@ -195,6 +195,8 @@ static int create_default_files(const char *template_path)
git_config(git_default_config, NULL);
is_bare_repository_cfg = init_is_bare_repository;
+
+ /* reading existing config may have overwrote it */
if (init_shared_repository != -1)
shared_repository = init_shared_repository;
@@ -313,12 +315,15 @@ int init_db(const char *template_dir, unsigned int flags)
* and compatibility values for PERM_GROUP and
* PERM_EVERYBODY.
*/
- if (shared_repository == PERM_GROUP)
+ if (shared_repository < 0)
+ /* force to the mode value */
+ sprintf(buf, "0%o", -shared_repository);
+ else if (shared_repository == PERM_GROUP)
sprintf(buf, "%d", OLD_PERM_GROUP);
else if (shared_repository == PERM_EVERYBODY)
sprintf(buf, "%d", OLD_PERM_EVERYBODY);
else
- sprintf(buf, "0%o", shared_repository);
+ die("oops");
git_config_set("core.sharedrepository", buf);
git_config_set("receive.denyNonFastforwards", "true");
}
@@ -398,6 +403,9 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
usage(init_db_usage);
}
+ if (init_shared_repository != -1)
+ shared_repository = init_shared_repository;
+
/*
* GIT_WORK_TREE makes sense only in conjunction with GIT_DIR
* without --bare. Catch the error early.
diff --git a/path.c b/path.c
index e332b50..42898e0 100644
--- a/path.c
+++ b/path.c
@@ -314,33 +314,39 @@ char *enter_repo(char *path, int strict)
int adjust_shared_perm(const char *path)
{
struct stat st;
- int mode;
+ int mode, tweak, shared;
if (!shared_repository)
return 0;
if (lstat(path, &st) < 0)
return -1;
mode = st.st_mode;
-
- if (shared_repository) {
- int tweak = shared_repository;
- if (!(mode & S_IWUSR))
- tweak &= ~0222;
+ if (shared_repository < 0)
+ shared = -shared_repository;
+ else
+ shared = shared_repository;
+ tweak = shared;
+
+ if (!(mode & S_IWUSR))
+ tweak &= ~0222;
+ if (mode & S_IXUSR)
+ /* Copy read bits to execute bits */
+ tweak |= (tweak & 0444) >> 2;
+ if (shared_repository < 0)
+ mode = (mode & ~0777) | tweak;
+ else
mode |= tweak;
- } else {
- /* Preserve old PERM_UMASK behaviour */
- if (mode & S_IWUSR)
- mode |= S_IWGRP;
- }
if (S_ISDIR(mode)) {
- mode |= FORCE_DIR_SET_GID;
-
/* Copy read bits to execute bits */
- mode |= (shared_repository & 0444) >> 2;
+ mode |= (shared & 0444) >> 2;
+ mode |= FORCE_DIR_SET_GID;
}
- if ((mode & st.st_mode) != mode && chmod(path, mode) < 0)
+ if (((shared_repository < 0
+ ? (st.st_mode & (FORCE_DIR_SET_GID | 0777))
+ : (st.st_mode & mode)) != mode) &&
+ chmod(path, mode) < 0)
return -2;
return 0;
}
diff --git a/setup.c b/setup.c
index 6c2deda..ebd60de 100644
--- a/setup.c
+++ b/setup.c
@@ -434,7 +434,7 @@ int git_config_perm(const char *var, const char *value)
/*
* Treat values 0, 1 and 2 as compatibility cases, otherwise it is
- * a chmod value.
+ * a chmod value to restrict to.
*/
switch (i) {
case PERM_UMASK: /* 0 */
@@ -456,7 +456,7 @@ int git_config_perm(const char *var, const char *value)
* Mask filemode value. Others can not get write permission.
* x flags for directories are handled separately.
*/
- return i & 0666;
+ return -(i & 0666);
}
int check_repository_format_version(const char *var, const char *value, void *cb)
diff --git a/sha1_file.c b/sha1_file.c
index a07aa4e..45987bd 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2243,11 +2243,15 @@ static void write_sha1_file_prepare(const void *buf, unsigned long len,
}
/*
- * Move the just written object into its final resting place
+ * Move the just written object into its final resting place.
+ * NEEDSWORK: this should be renamed to finalize_temp_file() as
+ * "moving" is only a part of what it does, when no patch between
+ * master to pu changes the call sites of this function.
*/
int move_temp_to_file(const char *tmpfile, const char *filename)
{
int ret = 0;
+
if (link(tmpfile, filename))
ret = errno;
@@ -2275,6 +2279,8 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
/* FIXME!!! Collision check here ? */
}
+ if (adjust_shared_perm(filename))
+ return error("unable to set permission to '%s'", filename);
return 0;
}
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 653362b..d459854 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -126,4 +126,41 @@ test_expect_success 'git reflog expire honors core.sharedRepository' '
esac
'
+test_expect_success 'forced modes' '
+ mkdir -p templates/hooks &&
+ echo update-server-info >templates/hooks/post-update &&
+ chmod +x templates/hooks/post-update &&
+ echo : >random-file &&
+ mkdir new &&
+ (
+ cd new &&
+ umask 002 &&
+ git init --shared=0660 --template=../templates &&
+ >frotz &&
+ git add frotz &&
+ git commit -a -m initial &&
+ git repack
+ ) &&
+ find new/.git -print |
+ xargs ls -ld >actual &&
+
+ # Everything must be unaccessible to others
+ test -z "$(sed -n -e "/^.......---/d" actual)" &&
+
+ # All directories must have 2770
+ test -z "$(sed -n -e "/^drwxrws---/d" -e "/^d/p" actual)" &&
+
+ # post-update hook must be 0770
+ test -z "$(sed -n -e "/post-update/{
+ /^-rwxrwx---/d
+ p
+ }" actual)" &&
+
+ # All files inside objects must be 0440
+ test -z "$(sed -n -e "/objects\//{
+ /^d/d
+ /^-r--r-----/d
+ }" actual)"
+'
+
test_done
--
1.6.2.1.394.g50949
^ permalink raw reply related
* Re: [PATCH 01/10] refs: add "for_each_bisect_ref" function
From: Christian Couder @ 2009-03-26 7:48 UTC (permalink / raw)
To: Sverre Rabbelier; +Cc: Junio C Hamano, git, John Tapsell, Johannes Schindelin
In-Reply-To: <fabb9a1e0903252320j2edf4a8ct39f784c4319c3cb0@mail.gmail.com>
Hi Sverre,
Le jeudi 26 mars 2009, Sverre Rabbelier a écrit :
> Heya
>
> On Thu, Mar 26, 2009 at 05:55, Christian Couder <chriscool@tuxfamily.org>
wrote:
> > Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
>
> A 10 patches series with no cover letter?
I am not a big fan of cover letters. Usually I prefer adding comments in the
patches.
> And no description of the
> individual patches either!
There is a commit message in each patch. And many of the patches are very
small.
> C'mon Christian, you know better than that
> ;).
If some commit messages are not clear enough, please tell me and I will try
to improve them ;)
Regards,
Christian.
^ permalink raw reply
* Re: Reference for git.git release process
From: Andreas Ericsson @ 2009-03-26 8:05 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Raman Gupta, git
In-Reply-To: <7viqlxz9go.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
>
> In addition, you can keep older maintenance track around, i.e.
>
> git branch maint-X.Y.(Z-1) maint
> git checkout maint
> git merge master
>
> so that maintenance releases for even older codebase _could_ be issued
> _if_ necessary.
>
Assuming one tags ones releases (which one should, and git.git does),
creating maint-X.Y.Z when it's actually needed is a far better approach.
No morning coffee yet, Junio? ;-)
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* Re: Test that every revision builds before pushing changes?
From: Andreas Ericsson @ 2009-03-26 8:16 UTC (permalink / raw)
To: Daniel Pittman; +Cc: git
In-Reply-To: <87myb8aja1.fsf@rimspace.net>
Daniel Pittman wrote:
> G'day.
>
> I would like to ensure that my commits are fully bisectable before I
> commit them to an upstream repository, at least to the limits of an
> automatic tool for testing them.
>
> 'git bisect run' is similar: it can automatically locate the breaking in
> a test suite, for example, but that doesn't help me in the case of three
> commits, A (good), B (bad) and C (good, fixing B).
>
> I would much rather, in this case, use rebase to fix B so that it, too,
> builds before I push the changes and pollute a public repository with a
> broken changeset — and make bisect that much harder to use in future.
>
You can do that, but it requires manual work too. The trick is to make
the release branch immutable on the public repository and use topic
branches with per-developer namespaces. The per-developer namespace
thing is actually important, as it leaves the freedom to rewind and
recreate topics to the developers (which shared branches do not).
The manual step comes at merge-time; Someone has to be responsible for
merging all the topics that are to be included in the release branch
and make sure it builds and passes all tests after each merge.
This workflow is a bit cumbersome. NASA uses something like this but
with an extra step for multiple peer reviews on every feature/fix for
software they send to satellites. Or so I've heard anyways.
If you're thinking of a staging area that should queue all commits
and lock the repo while testing is in progress, you need to think
again, I'm afraid, as that locks up developer time in such huge
amounts that it isn't really worth it. Without the locking, you
get the problem of trying to automate merges (which may conflict
and need a manual resolution). Although I guess a merge conflict
could result in a delayed push error, so perhaps that could work
too. If you manage to cook up a solution for this, please make a
small writeup on this list how you went about achieving it.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
^ permalink raw reply
* Re: [BUG?] How to make a shared/restricted repo?
From: Johan Herland @ 2009-03-26 8:29 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vprg4rbmp.fsf@gitster.siamese.dyndns.org>
On Thursday 26 March 2009, Junio C Hamano wrote:
> To fix the loose object codepath, the earlier patch added a call to
> adjust_shared_perm() to write_loose_object() function, but after looking
> at your 7th patch, I realized that the pattern of file creation inside
> $GIT_DIR typically is to first create a temporary file, write to it, and
> then finish it off by calling move_temp_to_file(). The true purpose of
> the function is to "finalize the file being created", and it is misnamed
> in that it describes how its implementation does it currently (i.e. by
> renaming the temporary file to its final name), but it makes perfect
> sense to call adjust_shared_perm() inside it as a part of finalization.
> I think this should cover the codepaths your 7th patch fixed without
> actually touching them.
Yes, with one exception:
For the two cases index-pack.c, the chmod(foo, 0444) happens AFTER the
corresponding call to move_temp_to_file(xyzzy, foo). The chmod() in
adjust_shared_perms() would thus be overridden by the chmod(foo, 0444),
which is not what we want. In both cases, I think the chmod(foo, 0444)
can safely be moved up above the call to move_temp_to_file(). Something
like this (although I'm not sure about the semantics of 'from_stdin'):
diff --git a/index-pack.c b/index-pack.c
index 7546822..d289b6a 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -815,6 +815,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
}
}
+ if (from_stdin)
+ chmod(final_pack_name, 0444);
if (final_pack_name != curr_pack_name) {
if (!final_pack_name) {
snprintf(name, sizeof(name), "%s/pack/pack-%s.pack",
@@ -824,9 +826,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
if (move_temp_to_file(curr_pack_name, final_pack_name))
die("cannot store pack file");
}
- if (from_stdin)
- chmod(final_pack_name, 0444);
+ chmod(final_index_name, 0444);
if (final_index_name != curr_index_name) {
if (!final_index_name) {
snprintf(name, sizeof(name), "%s/pack/pack-%s.idx",
@@ -836,7 +837,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
if (move_temp_to_file(curr_index_name, final_index_name))
die("cannot store index file");
}
- chmod(final_index_name, 0444);
if (!from_stdin) {
printf("%s\n", sha1_to_hex(sha1));
> Could you eyeball and re-test it?
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Johan Herland <johan@herland.net>
> --- a/builtin-init-db.c
> +++ b/builtin-init-db.c
> @@ -195,6 +195,8 @@ static int create_default_files(const char
> *template_path)
>
> git_config(git_default_config, NULL);
> is_bare_repository_cfg = init_is_bare_repository;
> +
> + /* reading existing config may have overwrote it */
s/overwrote/overwritten/
Otherwise OK, AFAICS.
Have fun! :)
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
^ permalink raw reply related
* Re: [BUG?] How to make a shared/restricted repo?
From: Johannes Sixt @ 2009-03-26 8:41 UTC (permalink / raw)
To: Johan Herland; +Cc: Junio C Hamano, git
In-Reply-To: <200903260929.58321.johan@herland.net>
Johan Herland schrieb:
> For the two cases index-pack.c, the chmod(foo, 0444) happens AFTER the
> corresponding call to move_temp_to_file(xyzzy, foo). The chmod() in
> adjust_shared_perms() would thus be overridden by the chmod(foo, 0444),
> which is not what we want. In both cases, I think the chmod(foo, 0444)
> can safely be moved up above the call to move_temp_to_file(). Something
> like this (although I'm not sure about the semantics of 'from_stdin'):
>
> diff --git a/index-pack.c b/index-pack.c
> index 7546822..d289b6a 100644
> --- a/index-pack.c
> +++ b/index-pack.c
> @@ -815,6 +815,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
> }
> }
>
> + if (from_stdin)
> + chmod(final_pack_name, 0444);
> if (final_pack_name != curr_pack_name) {
> if (!final_pack_name) {
> snprintf(name, sizeof(name), "%s/pack/pack-%s.pack",
> @@ -824,9 +826,8 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
> if (move_temp_to_file(curr_pack_name, final_pack_name))
> die("cannot store pack file");
> }
> - if (from_stdin)
> - chmod(final_pack_name, 0444);
>
> + chmod(final_index_name, 0444);
> if (final_index_name != curr_index_name) {
> if (!final_index_name) {
> snprintf(name, sizeof(name), "%s/pack/pack-%s.idx",
> @@ -836,7 +837,6 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
> if (move_temp_to_file(curr_index_name, final_index_name))
> die("cannot store index file");
> }
> - chmod(final_index_name, 0444);
>
> if (!from_stdin) {
> printf("%s\n", sha1_to_hex(sha1));
You certainly meant to use the curr_*_name variants in the chmod lines,
no? This effectively undoes 33b65030, but that is not so good: On Windows
we cannot rename read-only files.
-- Hannes
^ permalink raw reply
* Re: [PATCH 0/8] Documentation: XSLT/asciidoc.conf cleanup; tty literals
From: Junio C Hamano @ 2009-03-26 8:59 UTC (permalink / raw)
To: Chris Johnsen; +Cc: git, Jeff King
In-Reply-To: <1237881866-5497-1-git-send-email-chris_johnsen@pobox.com>
Chris Johnsen <chris_johnsen@pobox.com> writes:
> I had a go at wrangling with the documentation generation tools
> to fix a couple of issues that I had noticed.
Thanks. I noticed that between you and Jeff there were some more
improvements discussed, but I tried this round (queued in 'pu') and the
results lost those infamous ".ft", which is very good ;-)
I also noticed you have a two-patch series to quiet the documentation
building procedure, but didn't queue after seeing you had "oops".
I am looking forward to seeing v2 of both series. Thanks.
And thanks, Jeff, for helping to get these series into shape.
^ permalink raw reply
* [PATCH TopGit] hooks/pre-commit.sh: fix bashism
From: Uwe Kleine-König @ 2009-03-26 9:00 UTC (permalink / raw)
To: Bert Wesarg; +Cc: Petr Baudis, git, martin f krafft, Marc Kleine-Budde
In-Reply-To: <1237981384-7857-1-git-send-email-bert.wesarg@googlemail.com>
This was introduced in fcb488d51e72c7414f9beb40ad06bf529b8b38dc.
A similar fix was suggested by martin f krafft, too.
Reported-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
this should fix the issue now.
If I don't get negative feed back I will push this change later today.
I'm open for acks, too.
Best regards and thanks
Uwe
hooks/pre-commit.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hooks/pre-commit.sh b/hooks/pre-commit.sh
index a12cfa6..9d677e9 100644
--- a/hooks/pre-commit.sh
+++ b/hooks/pre-commit.sh
@@ -20,7 +20,7 @@ tg_util
if head_=$(git symbolic-ref -q HEAD); then
case "$head_" in
refs/heads/*)
- git rev-parse -q --verify "${head_/#refs\/heads/refs\/top-bases}" >/dev/null || exit 0;;
+ git rev-parse -q --verify "refs/top-bases${head_#refs/heads}" >/dev/null || exit 0;;
*)
exit 0;;
esac
--
1.6.2
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply related
* Re: Test that every revision builds before pushing changes?
From: Daniel Pittman @ 2009-03-26 9:10 UTC (permalink / raw)
To: git
In-Reply-To: <49CB39E5.5060000@op5.se>
Andreas Ericsson <ae@op5.se> writes:
> Daniel Pittman wrote:
>>
>> I would like to ensure that my commits are fully bisectable before I
>> commit them to an upstream repository, at least to the limits of an
>> automatic tool for testing them.
>>
>> 'git bisect run' is similar: it can automatically locate the breaking in
>> a test suite, for example, but that doesn't help me in the case of three
>> commits, A (good), B (bad) and C (good, fixing B).
>>
>> I would much rather, in this case, use rebase to fix B so that it, too,
>> builds before I push the changes and pollute a public repository with a
>> broken changeset — and make bisect that much harder to use in future.
>
> You can do that, but it requires manual work too. The trick is to make
> the release branch immutable on the public repository and use topic
> branches with per-developer namespaces. The per-developer namespace
> thing is actually important, as it leaves the freedom to rewind and
> recreate topics to the developers (which shared branches do not).
>
> The manual step comes at merge-time; Someone has to be responsible for
> merging all the topics that are to be included in the release branch
> and make sure it builds and passes all tests after each merge.
Ah. You have not quite grasped what I was looking for: I was after a
tool to help automate that step, rather than a workflow around it.
For example, the responsible person for that testing could use the
hypothetical (until someone tells me where to find it):
git test public..test make test
Which would then effectively wrap:
for each revision between public and private:
git checkout revision
make test
# report if that fails, allow fixing the commit or whatever
# then 'git test continue' to carry on...
That turn the process from a manual one to an automated one: it runs
that command for every revision until it fails, or until they all pass.
Regards,
Daniel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox