* [PATCH 0/9] "git status" that is not "git commit --dry-run"
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
Here is an update relative to 7637868 (wt-status: collect untracked files
in a separate "collect" phase, 2009-08-10) that has been queued in 'next'.
[PATCH 1/9] and [PATCH 2/9] are the same from last night's fixes.
[PATCH 3/9] through [PATCH 6/9] introduce a new "git status" with
different semantics for 1.7.0 under a tentative name "git stat". They
will be squashed into one commit in the final round, as 4, 5, and 6 are
fix-ups, but are keft separate for easier review.
The new "git status" handles paths differently from the traditional
one. It used to be the preview of "git commit paths...", IOW,
"show what would happen if we try to make a partial commit of only
these paths". The new "git status" only limits the paths the output
talks about and is not a preview of anything at all anymore.
Another semantic change is that its exit status no longer says if
there is something to be committed in the index. We used to exit with
non-zero status if there is nothing to commit.
[PATCH 7/9] introduces a short format output.
The last two patches make the new "git status" official. They will be
squashed together into one commit in the final round, but are kept
separate for reviewability.
Junio C Hamano (9):
Documentation/git-commit.txt: describe --dry-run
git commit --dry-run -v: show diff in color when asked
git stat: the beginning
git stat: honor relative paths setting
git stat: show traditional status headers and trailers as well
git stat: pathspec limits, unlike traditional "git status"
git stat -s: short status output
git status: not "commit --dry-run" anymore
git-status: adjust tests
Documentation/git-commit.txt | 13 ++-
Documentation/git-status.txt | 79 +++++++++++++++++---
Makefile | 1 +
builtin-commit.c | 172 +++++++++++++++++++++++++++++++++++++-----
t/t6040-tracking-info.sh | 2 +-
t/t7060-wtstatus.sh | 8 +-
t/t7506-status-submodule.sh | 6 +-
t/t7508-status.sh | 12 ++-
wt-status.c | 10 ++-
wt-status.h | 1 +
10 files changed, 255 insertions(+), 49 deletions(-)
^ permalink raw reply
* [PATCH 1/9] Documentation/git-commit.txt: describe --dry-run
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-1-git-send-email-gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unchanged since the last round.
Documentation/git-commit.txt | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index d01ff5a..64f94cf 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -9,7 +9,7 @@ SYNOPSIS
--------
[verse]
'git commit' [-a | --interactive] [-s] [-v] [-u<mode>] [--amend] [--dry-run]
- [(-c | -C) <commit>] [-F <file> | -m <msg>]
+ [(-c | -C) <commit>] [-F <file> | -m <msg>] [--dry-run]
[--allow-empty] [--no-verify] [-e] [--author=<author>]
[--cleanup=<mode>] [--] [[-i | -o ]<file>...]
@@ -42,10 +42,9 @@ The content to be added can be specified in several ways:
by one which files should be part of the commit, before finalizing the
operation. Currently, this is done by invoking 'git-add --interactive'.
-The 'git-status' command can be used to obtain a
+The `--dry-run` option can be used to obtain a
summary of what is included by any of the above for the next
-commit by giving the same set of parameters you would give to
-this command.
+commit by giving the same set of parameters (options and paths).
If you make a commit and then find a mistake immediately after
that, you can recover from it with 'git-reset'.
@@ -70,6 +69,12 @@ OPTIONS
Like '-C', but with '-c' the editor is invoked, so that
the user can further edit the commit message.
+--dry-run::
+ Do not actually make a commit, but show the list of paths
+ with updates in the index, paths with changes in the work tree,
+ and paths that are untracked, similar to the one that is given
+ in the commit log editor.
+
-F <file>::
--file=<file>::
Take the commit message from the given file. Use '-' to
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 2/9] git commit --dry-run -v: show diff in color when asked
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-2-git-send-email-gitster@pobox.com>
The earlier implementation of --dry-run didn't duplicate the use of color
"git status -v" set up for diff output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unchanged since the last round.
builtin-commit.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 1c200eb..200ffda 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -979,9 +979,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
argc = parse_and_validate_options(argc, argv, builtin_commit_usage,
prefix, &s);
- if (dry_run)
+ if (dry_run) {
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
return dry_run_commit(argc, argv, prefix, &s);
-
+ }
index_file = prepare_index(argc, argv, prefix, 0);
/* Set up everything for writing the commit object. This includes
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 3/9] git stat: the beginning
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-3-git-send-email-gitster@pobox.com>
Tentatively add "git stat" as a new command. This does not munge the
index with paths parameters before showing the status like "git status"
does. In later rounds, we will take path parameters as pathspec to limit
the output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unchanged since the last round.
Makefile | 1 +
builtin-commit.c | 64 +++++++++++++++++++++++++++++++++++++++++++++--------
builtin.h | 1 +
git.c | 1 +
wt-status.c | 23 +++++++++++-------
wt-status.h | 1 +
6 files changed, 72 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index daf4296..39dd334 100644
--- a/Makefile
+++ b/Makefile
@@ -378,6 +378,7 @@ BUILT_INS += git-init$X
BUILT_INS += git-merge-subtree$X
BUILT_INS += git-peek-remote$X
BUILT_INS += git-repo-config$X
+BUILT_INS += git-stat$X
BUILT_INS += git-show$X
BUILT_INS += git-stage$X
BUILT_INS += git-status$X
diff --git a/builtin-commit.c b/builtin-commit.c
index 200ffda..0ef7c8f 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -24,6 +24,7 @@
#include "string-list.h"
#include "rerere.h"
#include "unpack-trees.h"
+#include "quote.h"
static const char * const builtin_commit_usage[] = {
"git commit [options] [--] <filepattern>...",
@@ -35,6 +36,11 @@ static const char * const builtin_status_usage[] = {
NULL
};
+static const char * const builtin_stat_usage[] = {
+ "git stat [options]",
+ NULL
+};
+
static unsigned char head_sha1[20], merge_head_sha1[20];
static char *use_message_buffer;
static const char commit_editmsg[] = "COMMIT_EDITMSG";
@@ -691,6 +697,21 @@ static const char *find_author_by_nickname(const char *name)
die("No existing author found with '%s'", name);
}
+
+static void handle_untracked_files_arg(struct wt_status *s)
+{
+ if (!untracked_files_arg)
+ ; /* default already initialized */
+ else if (!strcmp(untracked_files_arg, "no"))
+ s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "normal"))
+ s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
+ else if (!strcmp(untracked_files_arg, "all"))
+ s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
+ else
+ die("Invalid untracked files mode '%s'", untracked_files_arg);
+}
+
static int parse_and_validate_options(int argc, const char *argv[],
const char * const usage[],
const char *prefix,
@@ -794,16 +815,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
else
die("Invalid cleanup mode %s", cleanup_arg);
- if (!untracked_files_arg)
- ; /* default already initialized */
- else if (!strcmp(untracked_files_arg, "no"))
- s->show_untracked_files = SHOW_NO_UNTRACKED_FILES;
- else if (!strcmp(untracked_files_arg, "normal"))
- s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
- else if (!strcmp(untracked_files_arg, "all"))
- s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
- else
- die("Invalid untracked files mode '%s'", untracked_files_arg);
+ handle_untracked_files_arg(s);
if (all && argc > 0)
die("Paths with -a does not make sense.");
@@ -886,6 +898,38 @@ static int git_status_config(const char *k, const char *v, void *cb)
return git_diff_ui_config(k, v, NULL);
}
+int cmd_stat(int argc, const char **argv, const char *prefix)
+{
+ struct wt_status s;
+ unsigned char sha1[20];
+ static struct option builtin_stat_options[] = {
+ { OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
+ "mode",
+ "show untracked files, optional modes: all, normal, no. (Default: all)",
+ PARSE_OPT_OPTARG, NULL, (intptr_t)"all" },
+ OPT_END(),
+ };
+
+ wt_status_prepare(&s);
+ git_config(git_status_config, &s);
+ argc = parse_options(argc, argv, prefix,
+ builtin_stat_options,
+ builtin_stat_usage, 0);
+ handle_untracked_files_arg(&s);
+
+ read_cache();
+ refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
+ s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
+ wt_status_collect(&s);
+
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+ wt_status_print_body(&s);
+ return 0;
+}
+
int cmd_status(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
diff --git a/builtin.h b/builtin.h
index 20427d2..eeaf0b6 100644
--- a/builtin.h
+++ b/builtin.h
@@ -95,6 +95,7 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
extern int cmd_show(int argc, const char **argv, const char *prefix);
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
+extern int cmd_stat(int argc, const char **argv, const char *prefix);
extern int cmd_status(int argc, const char **argv, const char *prefix);
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index 807d875..de7fcf6 100644
--- a/git.c
+++ b/git.c
@@ -350,6 +350,7 @@ static void handle_internal_command(int argc, const char **argv)
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
+ { "stat", cmd_stat, RUN_SETUP | NEED_WORK_TREE },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
diff --git a/wt-status.c b/wt-status.c
index 63598ce..c887a90 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -531,6 +531,19 @@ static void wt_status_print_tracking(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
+void wt_status_print_body(struct wt_status *s)
+{
+ wt_status_print_unmerged(s);
+ wt_status_print_updated(s);
+ wt_status_print_changed(s);
+ if (s->submodule_summary)
+ wt_status_print_submodule_summary(s);
+ if (s->show_untracked_files)
+ wt_status_print_untracked(s);
+ else if (s->commitable)
+ fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
+}
+
void wt_status_print(struct wt_status *s)
{
unsigned char sha1[20];
@@ -561,15 +574,7 @@ void wt_status_print(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
- wt_status_print_unmerged(s);
- wt_status_print_updated(s);
- wt_status_print_changed(s);
- if (s->submodule_summary)
- wt_status_print_submodule_summary(s);
- if (s->show_untracked_files)
- wt_status_print_untracked(s);
- else if (s->commitable)
- fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
+ wt_status_print_body(s);
if (s->verbose)
wt_status_print_verbose(s);
diff --git a/wt-status.h b/wt-status.h
index a0e7517..ab52ce1 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -54,5 +54,6 @@ struct wt_status {
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect(struct wt_status *s);
+void wt_status_print_body(struct wt_status *s);
#endif /* STATUS_H */
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 4/9] git stat: honor relative paths setting
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-4-git-send-email-gitster@pobox.com>
When run from a subdirectory, by default (and when status.relativepaths is
set), we should pass it to wt_status_print_body()
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Fix-up to 3/9; will be squashed in the final round.
builtin-commit.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 0ef7c8f..7120876 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -922,6 +922,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
wt_status_collect(&s);
+ if (s.relative_paths)
+ s.prefix = prefix;
if (s.use_color == -1)
s.use_color = git_use_color_default;
if (diff_use_color_default == -1)
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 6/9] git stat: pathspec limits, unlike traditional "git status"
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-6-git-send-email-gitster@pobox.com>
The "git stat" command is not "preview of commit with the same arguments";
the path parameters are not paths to be added to the pristine index (aka
"--only" option), but are taken as pathspecs to limit the output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Fix-up to 3/9; will be squashed in the final round.
builtin-commit.c | 3 +++
wt-status.c | 6 ++++++
wt-status.h | 1 +
3 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 8db0365..5e23ef1 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -922,6 +922,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
builtin_stat_usage, 0);
handle_untracked_files_arg(&s);
+ if (*argv)
+ s.pathspec = get_pathspec(prefix, argv);
+
read_cache();
refresh_cache(REFRESH_QUIET|REFRESH_UNMERGED);
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
diff --git a/wt-status.c b/wt-status.c
index c55be53..249227c 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -269,6 +269,7 @@ static void wt_status_collect_changes_worktree(struct wt_status *s)
rev.diffopt.output_format |= DIFF_FORMAT_CALLBACK;
rev.diffopt.format_callback = wt_status_collect_changed_cb;
rev.diffopt.format_callback_data = s;
+ rev.prune_data = s->pathspec;
run_diff_files(&rev, 0);
}
@@ -285,6 +286,7 @@ static void wt_status_collect_changes_index(struct wt_status *s)
rev.diffopt.detect_rename = 1;
rev.diffopt.rename_limit = 200;
rev.diffopt.break_opt = 0;
+ rev.prune_data = s->pathspec;
run_diff_index(&rev, 1);
}
@@ -297,6 +299,8 @@ static void wt_status_collect_changes_initial(struct wt_status *s)
struct wt_status_change_data *d;
struct cache_entry *ce = active_cache[i];
+ if (!ce_path_match(ce, s->pathspec))
+ continue;
it = string_list_insert(ce->name, &s->change);
d = it->util;
if (!d) {
@@ -330,6 +334,8 @@ static void wt_status_collect_untracked(struct wt_status *s)
struct dir_entry *ent = dir.entries[i];
if (!cache_name_is_other(ent->name, ent->len))
continue;
+ if (!match_pathspec(s->pathspec, ent->name, ent->len, 0, NULL))
+ continue;
s->workdir_untracked = 1;
string_list_insert(ent->name, &s->untracked);
}
diff --git a/wt-status.h b/wt-status.h
index a0e7517..09fd9f1 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -31,6 +31,7 @@ struct wt_status {
int is_initial;
char *branch;
const char *reference;
+ const char **pathspec;
int verbose;
int amend;
int nowarn;
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 5/9] git stat: show traditional status headers and trailers as well
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-5-git-send-email-gitster@pobox.com>
Also honor -v to show the "diff --cached" output.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Fix-up to 3/9; will be squashed in the final round to remove the trace
of ill conceived wt_status_print_body() refactoring.
builtin-commit.c | 8 +++++++-
wt-status.c | 27 +++++++++------------------
wt-status.h | 1 -
3 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 7120876..8db0365 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -352,6 +352,8 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
static int run_status(FILE *fp, const char *index_file, const char *prefix, int nowarn,
struct wt_status *s)
{
+ unsigned char sha1[20];
+
if (s->relative_paths)
s->prefix = prefix;
@@ -363,7 +365,9 @@ static int run_status(FILE *fp, const char *index_file, const char *prefix, int
s->index_file = index_file;
s->fp = fp;
s->nowarn = nowarn;
+ s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
+ wt_status_collect(s);
wt_status_print(s);
return s->commitable;
@@ -903,6 +907,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
struct wt_status s;
unsigned char sha1[20];
static struct option builtin_stat_options[] = {
+ OPT__VERBOSE(&verbose),
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
"mode",
"show untracked files, optional modes: all, normal, no. (Default: all)",
@@ -922,13 +927,14 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
wt_status_collect(&s);
+ s.verbose = verbose;
if (s.relative_paths)
s.prefix = prefix;
if (s.use_color == -1)
s.use_color = git_use_color_default;
if (diff_use_color_default == -1)
diff_use_color_default = git_use_color_default;
- wt_status_print_body(&s);
+ wt_status_print(&s);
return 0;
}
diff --git a/wt-status.c b/wt-status.c
index c887a90..c55be53 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -531,25 +531,10 @@ static void wt_status_print_tracking(struct wt_status *s)
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
-void wt_status_print_body(struct wt_status *s)
-{
- wt_status_print_unmerged(s);
- wt_status_print_updated(s);
- wt_status_print_changed(s);
- if (s->submodule_summary)
- wt_status_print_submodule_summary(s);
- if (s->show_untracked_files)
- wt_status_print_untracked(s);
- else if (s->commitable)
- fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
-}
-
void wt_status_print(struct wt_status *s)
{
- unsigned char sha1[20];
const char *branch_color = color(WT_STATUS_HEADER, s);
- s->is_initial = get_sha1(s->reference, sha1) ? 1 : 0;
if (s->branch) {
const char *on_what = "On branch ";
const char *branch_name = s->branch;
@@ -566,15 +551,21 @@ void wt_status_print(struct wt_status *s)
wt_status_print_tracking(s);
}
- wt_status_collect(s);
-
if (s->is_initial) {
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "# Initial commit");
color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
}
- wt_status_print_body(s);
+ wt_status_print_unmerged(s);
+ wt_status_print_updated(s);
+ wt_status_print_changed(s);
+ if (s->submodule_summary)
+ wt_status_print_submodule_summary(s);
+ if (s->show_untracked_files)
+ wt_status_print_untracked(s);
+ else if (s->commitable)
+ fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
if (s->verbose)
wt_status_print_verbose(s);
diff --git a/wt-status.h b/wt-status.h
index ab52ce1..a0e7517 100644
--- a/wt-status.h
+++ b/wt-status.h
@@ -54,6 +54,5 @@ struct wt_status {
void wt_status_prepare(struct wt_status *s);
void wt_status_print(struct wt_status *s);
void wt_status_collect(struct wt_status *s);
-void wt_status_print_body(struct wt_status *s);
#endif /* STATUS_H */
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 8/9] git status: not "commit --dry-run" anymore
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-8-git-send-email-gitster@pobox.com>
This removes tentative "git stat" and make it take over "git status".
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This alone fails some tests; 9/9 will be squashed in in the final round.
Documentation/git-status.txt | 79 ++++++++++++++++++++++++++++++++++++-----
builtin-commit.c | 29 ++-------------
builtin.h | 1 -
git.c | 1 -
4 files changed, 73 insertions(+), 37 deletions(-)
diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
index 84f60f3..b5939d6 100644
--- a/Documentation/git-status.txt
+++ b/Documentation/git-status.txt
@@ -8,7 +8,7 @@ git-status - Show the working tree status
SYNOPSIS
--------
-'git status' <options>...
+'git status' [<options>...] [--] [<pathspec>...]
DESCRIPTION
-----------
@@ -20,25 +20,85 @@ are what you _would_ commit by running `git commit`; the second and
third are what you _could_ commit by running 'git-add' before running
`git commit`.
-The command takes the same set of options as 'git-commit'; it
-shows what would be committed if the same options are given to
-'git-commit'.
-
-If there is no path that is different between the index file and
-the current HEAD commit (i.e., there is nothing to commit by running
-`git commit`), the command exits with non-zero status.
+OPTIONS
+-------
+
+-s::
+--short::
+ Give the output in the short-format.
+
+-u[<mode>]::
+--untracked-files[=<mode>]::
+ Show untracked files (Default: 'all').
++
+The mode parameter is optional, and is used to specify
+the handling of untracked files. The possible options are:
++
+--
+ - 'no' - Show no untracked files
+ - 'normal' - Shows untracked files and directories
+ - 'all' - Also shows individual files in untracked directories.
+--
++
+See linkgit:git-config[1] for configuration variable
+used to change the default for when the option is not
+specified.
+
+-z::
+ Terminate entries with NUL, instead of LF. This implies `-s`
+ (short status) output format.
OUTPUT
------
The output from this command is designed to be used as a commit
template comment, and all the output lines are prefixed with '#'.
+The default, long format, is designed to be human readable,
+verbose and descriptive. They are subject to change in any time.
The paths mentioned in the output, unlike many other git commands, are
made relative to the current directory if you are working in a
subdirectory (this is on purpose, to help cutting and pasting). See
the status.relativePaths config option below.
+In short-format, the status of each path is shown as
+
+ XY PATH1 -> PATH2
+
+where `PATH1` is the path in the `HEAD`, and ` -> PATH2` part is
+shown only when `PATH1` corresponds to a different path in the
+index/worktree (i.e. renamed).
+
+For unmerged entries, `X` shows the status of stage #2 (i.e. ours) and `Y`
+shows the status of stage #3 (i.e. theirs).
+
+For entries that do not have conflicts, `X` shows the status of the index,
+and `Y` shows the status of the work tree. For untracked paths, `XY` are
+`??`.
+
+ X Y Meaning
+ -------------------------------------------------
+ [MD] not updated
+ M [ MD] updated in index
+ A [ MD] added to index
+ D [ MD] deleted from index
+ R [ MD] renamed in index
+ C [ MD] copied in index
+ [MARC] index and work tree matches
+ [ MARC] M work tree changed since index
+ [ MARC] D deleted in work tree
+ -------------------------------------------------
+ D D unmerged, both deleted
+ A U unmerged, added by us
+ U D unmerged, deleted by them
+ U A unmerged, added by them
+ D U unmerged, deleted by us
+ A A unmerged, both added
+ U U unmerged, both modified
+ -------------------------------------------------
+ ? ? untracked
+ -------------------------------------------------
+
CONFIGURATION
-------------
@@ -63,8 +123,7 @@ linkgit:gitignore[5]
Author
------
-Written by Linus Torvalds <torvalds@osdl.org> and
-Junio C Hamano <gitster@pobox.com>.
+Written by Junio C Hamano <gitster@pobox.com>.
Documentation
--------------
diff --git a/builtin-commit.c b/builtin-commit.c
index 1a360cb..6cb0e40 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -36,11 +36,6 @@ static const char * const builtin_status_usage[] = {
NULL
};
-static const char * const builtin_stat_usage[] = {
- "git stat [options]",
- NULL
-};
-
static unsigned char head_sha1[20], merge_head_sha1[20];
static char *use_message_buffer;
static const char commit_editmsg[] = "COMMIT_EDITMSG";
@@ -971,13 +966,13 @@ static void short_untracked(int null_termination, struct string_list_item *it,
}
}
-int cmd_stat(int argc, const char **argv, const char *prefix)
+int cmd_status(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
static int null_termination, shortstatus;
int i;
unsigned char sha1[20];
- static struct option builtin_stat_options[] = {
+ static struct option builtin_status_options[] = {
OPT__VERBOSE(&verbose),
OPT_BOOLEAN('s', "short", &shortstatus,
"show status concicely"),
@@ -996,8 +991,8 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
wt_status_prepare(&s);
git_config(git_status_config, &s);
argc = parse_options(argc, argv, prefix,
- builtin_stat_options,
- builtin_stat_usage, 0);
+ builtin_status_options,
+ builtin_status_usage, 0);
handle_untracked_files_arg(&s);
if (*argv)
@@ -1039,22 +1034,6 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
return 0;
}
-int cmd_status(int argc, const char **argv, const char *prefix)
-{
- struct wt_status s;
-
- wt_status_prepare(&s);
- git_config(git_status_config, &s);
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
-
- argc = parse_and_validate_options(argc, argv, builtin_status_usage,
- prefix, &s);
- return dry_run_commit(argc, argv, prefix, &s);
-}
-
static void print_summary(const char *prefix, const unsigned char *sha1)
{
struct rev_info rev;
diff --git a/builtin.h b/builtin.h
index eeaf0b6..20427d2 100644
--- a/builtin.h
+++ b/builtin.h
@@ -95,7 +95,6 @@ extern int cmd_send_pack(int argc, const char **argv, const char *prefix);
extern int cmd_shortlog(int argc, const char **argv, const char *prefix);
extern int cmd_show(int argc, const char **argv, const char *prefix);
extern int cmd_show_branch(int argc, const char **argv, const char *prefix);
-extern int cmd_stat(int argc, const char **argv, const char *prefix);
extern int cmd_status(int argc, const char **argv, const char *prefix);
extern int cmd_stripspace(int argc, const char **argv, const char *prefix);
extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix);
diff --git a/git.c b/git.c
index de7fcf6..807d875 100644
--- a/git.c
+++ b/git.c
@@ -350,7 +350,6 @@ static void handle_internal_command(int argc, const char **argv)
{ "shortlog", cmd_shortlog, USE_PAGER },
{ "show-branch", cmd_show_branch, RUN_SETUP },
{ "show", cmd_show, RUN_SETUP | USE_PAGER },
- { "stat", cmd_stat, RUN_SETUP | NEED_WORK_TREE },
{ "status", cmd_status, RUN_SETUP | NEED_WORK_TREE },
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 9/9] git-status: adjust tests
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-9-git-send-email-gitster@pobox.com>
There are some tests that expect "git status" to exit with non-zero status
when there is something staged. Some tests expect "git status path..." to
show the status for a partial commit.
For these, replace "git status" with "git commit --dry-run". For the
ones that do not attempt a dry-run of a partial commit that check the
output from the command, check the output from "git status" as well, as
they should be identical.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Kept separate for easier review; shows the extent of damage from the
change in semantics rather well.
t/t6040-tracking-info.sh | 2 +-
t/t7060-wtstatus.sh | 8 +++++---
t/t7506-status-submodule.sh | 6 +++---
t/t7508-status.sh | 12 +++++++-----
4 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 00e1de9..664b0f8 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -69,7 +69,7 @@ test_expect_success 'status' '
cd test &&
git checkout b1 >/dev/null &&
# reports nothing to commit
- test_must_fail git status
+ test_must_fail git commit --dry-run
) >actual &&
grep "have 1 and 1 different" actual
'
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index 1044aa6..7b5db80 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -50,9 +50,11 @@ test_expect_success 'M/D conflict does not segfault' '
git rm foo &&
git commit -m delete &&
test_must_fail git merge master &&
- test_must_fail git status > ../actual
- ) &&
- test_cmp expect actual
+ test_must_fail git commit --dry-run >../actual &&
+ test_cmp ../expect ../actual &&
+ git status >../actual &&
+ test_cmp ../expect ../actual
+ )
'
test_done
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index d9a08aa..3ca17ab 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -19,8 +19,8 @@ test_expect_success 'status clean' '
git status |
grep "nothing to commit"
'
-test_expect_success 'status -a clean' '
- git status -a |
+test_expect_success 'commit --dry-run -a clean' '
+ git commit --dry-run -a |
grep "nothing to commit"
'
test_expect_success 'rm submodule contents' '
@@ -31,7 +31,7 @@ test_expect_success 'status clean (empty submodule dir)' '
grep "nothing to commit"
'
test_expect_success 'status -a clean (empty submodule dir)' '
- git status -a |
+ git commit --dry-run -a |
grep "nothing to commit"
'
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index 93f875f..1173dbb 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -248,8 +248,8 @@ cat <<EOF >expect
# output
# untracked
EOF
-test_expect_success 'status of partial commit excluding new file in index' '
- git status dir1/modified >output &&
+test_expect_success 'dry-run of partial commit excluding new file in index' '
+ git commit --dry-run dir1/modified >output &&
test_cmp expect output
'
@@ -358,7 +358,9 @@ EOF
test_expect_success 'status submodule summary (clean submodule)' '
git commit -m "commit submodule" &&
git config status.submodulesummary 10 &&
- test_must_fail git status >output &&
+ test_must_fail git commit --dry-run >output &&
+ test_cmp expect output &&
+ git status >output &&
test_cmp expect output
'
@@ -391,9 +393,9 @@ cat >expect <<EOF
# output
# untracked
EOF
-test_expect_success 'status submodule summary (--amend)' '
+test_expect_success 'commit --dry-run submodule summary (--amend)' '
git config status.submodulesummary 10 &&
- git status --amend >output &&
+ git commit --dry-run --amend >output &&
test_cmp expect output
'
--
1.6.4.224.g3be84
^ permalink raw reply related
* [PATCH 7/9] git stat -s: short status output
From: Junio C Hamano @ 2009-08-15 22:39 UTC (permalink / raw)
To: git
In-Reply-To: <1250375997-10657-7-git-send-email-gitster@pobox.com>
Give -s(hort) option to "git stat" that shows the status of paths in a
more concise way.
XY PATH1 -> PATH2
format to be more machine readable than output from "git status", which is
about previewing of "git commit" with the same arguments.
PATH1 is the path in the HEAD, and " -> PATH2" part is shown only when
PATH1 corresponds to a different path in the index/worktree.
For unmerged entries, X shows the status of stage #2 (i.e. ours) and Y
shows the status of stage #3 (i.e. theirs). For entries that do not have
conflicts, X shows the status of the index, and Y shows the status of the
work tree. For untracked paths, XY are "??".
X Y Meaning
-------------------------------------------------
[MD] not updated
M [ MD] updated in index
A [ MD] added to index
D [ MD] deleted from index
R [ MD] renamed in index
C [ MD] copied in index
[MARC] index and work tree matches
[ MARC] M work tree changed since index
[ MARC] D deleted in work tree
D D unmerged, both deleted
A U unmerged, added by us
U D unmerged, deleted by them
U A unmerged, added by them
D U unmerged, deleted by us
A A unmerged, both added
U U unmerged, both modified
? ? untracked
When given -z option, the records are terminated by NUL characters for
better machine readability. Because the traditional long format is
designed for human consumption, NUL termination does not make sense.
For this reason, -z option implies -s (short output).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* Unchanged since the last round; rebased on top of the updated code to
support the long format output.
builtin-commit.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 106 insertions(+), 8 deletions(-)
diff --git a/builtin-commit.c b/builtin-commit.c
index 5e23ef1..1a360cb 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -902,12 +902,87 @@ static int git_status_config(const char *k, const char *v, void *cb)
return git_diff_ui_config(k, v, NULL);
}
+#define quote_path quote_path_relative
+
+static void short_unmerged(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ struct wt_status_change_data *d = it->util;
+ const char *how = "??";
+
+ switch (d->stagemask) {
+ case 1: how = "DD"; break; /* both deleted */
+ case 2: how = "AU"; break; /* added by us */
+ case 3: how = "UD"; break; /* deleted by them */
+ case 4: how = "UA"; break; /* added by them */
+ case 5: how = "DU"; break; /* deleted by us */
+ case 6: how = "AA"; break; /* both added */
+ case 7: how = "UU"; break; /* both modified */
+ }
+ printf("%s ", how);
+ if (null_termination) {
+ fprintf(stdout, "%s%c", it->string, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("%s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
+static void short_status(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ struct wt_status_change_data *d = it->util;
+
+ printf("%c%c ",
+ !d->index_status ? ' ' : d->index_status,
+ !d->worktree_status ? ' ' : d->worktree_status);
+ if (null_termination) {
+ fprintf(stdout, "%s%c", it->string, 0);
+ if (d->head_path)
+ fprintf(stdout, "%s%c", d->head_path, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ if (d->head_path) {
+ one = quote_path(d->head_path, -1, &onebuf, s->prefix);
+ printf("%s -> ", one);
+ strbuf_release(&onebuf);
+ }
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("%s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
+static void short_untracked(int null_termination, struct string_list_item *it,
+ struct wt_status *s)
+{
+ if (null_termination) {
+ fprintf(stdout, "?? %s%c", it->string, 0);
+ } else {
+ struct strbuf onebuf = STRBUF_INIT;
+ const char *one;
+ one = quote_path(it->string, -1, &onebuf, s->prefix);
+ printf("?? %s\n", one);
+ strbuf_release(&onebuf);
+ }
+}
+
int cmd_stat(int argc, const char **argv, const char *prefix)
{
struct wt_status s;
+ static int null_termination, shortstatus;
+ int i;
unsigned char sha1[20];
static struct option builtin_stat_options[] = {
OPT__VERBOSE(&verbose),
+ OPT_BOOLEAN('s', "short", &shortstatus,
+ "show status concicely"),
+ OPT_BOOLEAN('z', "null", &null_termination,
+ "terminate entries with NUL"),
{ OPTION_STRING, 'u', "untracked-files", &untracked_files_arg,
"mode",
"show untracked files, optional modes: all, normal, no. (Default: all)",
@@ -915,6 +990,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
OPT_END(),
};
+ if (null_termination)
+ shortstatus = 1;
+
wt_status_prepare(&s);
git_config(git_status_config, &s);
argc = parse_options(argc, argv, prefix,
@@ -930,14 +1008,34 @@ int cmd_stat(int argc, const char **argv, const char *prefix)
s.is_initial = get_sha1(s.reference, sha1) ? 1 : 0;
wt_status_collect(&s);
- s.verbose = verbose;
- if (s.relative_paths)
- s.prefix = prefix;
- if (s.use_color == -1)
- s.use_color = git_use_color_default;
- if (diff_use_color_default == -1)
- diff_use_color_default = git_use_color_default;
- wt_status_print(&s);
+ if (shortstatus) {
+ for (i = 0; i < s.change.nr; i++) {
+ struct wt_status_change_data *d;
+ struct string_list_item *it;
+
+ it = &(s.change.items[i]);
+ d = it->util;
+ if (d->stagemask)
+ short_unmerged(null_termination, it, &s);
+ else
+ short_status(null_termination, it, &s);
+ }
+ for (i = 0; i < s.untracked.nr; i++) {
+ struct string_list_item *it;
+
+ it = &(s.untracked.items[i]);
+ short_untracked(null_termination, it, &s);
+ }
+ } else {
+ s.verbose = verbose;
+ if (s.relative_paths)
+ s.prefix = prefix;
+ if (s.use_color == -1)
+ s.use_color = git_use_color_default;
+ if (diff_use_color_default == -1)
+ diff_use_color_default = git_use_color_default;
+ wt_status_print(&s);
+ }
return 0;
}
--
1.6.4.224.g3be84
^ permalink raw reply related
* Re: [RFC PATCH v3 8/8] --sparse for porcelains
From: Jakub Narebski @ 2009-08-15 23:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Nguyen Thai Ngoc Duy, git, Johannes Schindelin
In-Reply-To: <7veird4yyi.fsf@alter.siamese.dyndns.org>
On Sat, 15 Aug 2009, Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes:
>
>>>> Hmmm... this looks like either argument for introducing --full option
>>>> to git-checkout (ignore CE_VALID bit, checkout everything, and clean
>>>> CE_VALID (?))...
>>>>
>>>> ...or for going with _separate_ bit for partial checkout, like in the
>>>> very first version of this series, which otherwise functions like
>>>> CE_VALID, or is just used to mark that CE_VALID was set using sparse.
>
> How would a separate bit help? Just like you need to clear CE_VALID bit
> to revert the index into a normal (or "non sparse") state somehow, you
> would need to have a way to clear that separate bit anyway.
>
> A separate bit would help only if you want to handle assume-unchanged and
> sparse checkout independently. But my impression was that the recent lstat
> reduction effort addressed the issue assume-unchanged were invented to
> work around in the first place.
Well, if we assume that we don't need (don't want) to handle
assume-unchanged and sparse checkout independently, then of course the
idea of having separate or additional bit for sparse doesn't make sense.
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: Linus' sha1 is much faster!
From: Theodore Tso @ 2009-08-16 0:06 UTC (permalink / raw)
To: John Tapsell
Cc: Bryan Donlan, Pádraig Brady, Bug-coreutils, Linus Torvalds,
Git Mailing List, Brandon Casey, Junio C Hamano, Nicolas Pitre
In-Reply-To: <43d8ce650908151312o6a43416el27965c4b0ab8d83d@mail.gmail.com>
On Sat, Aug 15, 2009 at 09:12:58PM +0100, John Tapsell wrote:
> 2009/8/15 Bryan Donlan <bdonlan@gmail.com>:
> > coreutils is licensed under GPLv3, and git under GPLv2 (only), so
> > you'd need permission from all contributors to the implementation in
> > order to relicense under GPLv3. A quick grep of the history suggests
> > these contributors to be:
>
> X11 also requires a fast SHA1 implementation. It uses this to check
> if two pixmaps are the same. So it would be really nice to relicense
> under a liberal enough license that xorg can use it.
If the checksum isn't being exposed in the protocol (i.e., it's just
internal to the X server), one possibility for X11 is to consider to
use the SHA-3 candidate Skein instead. After receiving a large amount
of evaluation by cryptographic experts, it was one of the 18
algorithms (our of an original 64 entries) that have made it the 2nd
round of the NIST competition. It's also *substantially* faster than
SHA:
One exception to this is Skein, created by several well-known
cryptographers and noted pundit Bruce Schneier. It was designed
specifically to exploit all three of the Core 2 execution units
and to run at a full 64-bits. This gives it roughly four to 10
times the logic density of competing submissions.
This is what I meant by the Matrix quote above. They didn't bend
the spoon; they bent the crypto algorithm. They moved the logic
operations around in a way that wouldn't weaken the crypto, but
would strengthen its speed on the Intel Core 2.
In their paper (PDF), the authors of Skein express surprise that a
custom silicon ASIC implementation is not any faster than the
software implementation. They shouldn't be surprised. Every time
you can redefine a problem to run optimally in software, you will
reach the same speeds you get with optimized ASIC hardware. The
reason software has a reputation of being slow is because people
don't redefine the original problem.
http://www.darkreading.com/blog/archives/2008/11/bending_skein_c.html
For more information and some optimized implementation, see:
http://www.skein-hash.info/
- Ted
^ permalink raw reply
* How to stop sharing objects between repositories
From: Jon Jensen @ 2009-08-16 0:04 UTC (permalink / raw)
To: git
Hello.
Situation: I used "git clone -s" to share objects between repositories.
That creates .git/objects/info/alternates, which points to the other
repository. Later I need to remove the dependency and make the dependent
repository self-sufficient, i.e. it should have all the objects internal
to itself.
I've looked around for a way to do that but haven't found either tools or
instructions.
I came up with this manual way, copying over the unique remote objects and
then removing the alternate repository pointer:
(cd /path/to/alternate/repo.git/objects && tar cp .) | (cd .git/objects && tar xvpk)
# some objects will already exist and be skipped, leading to an error on exit, which is fine
rm .git/objects/info/alternates
# or if there's more than one and you're only removing one, edit the alternates file and remove only that pointer
(With GNU tar -C the copy is a little simpler.)
I posted this to the wiki:
http://git.or.cz/gitwiki/GitFaq#Howtostopsharingobjectsbetweenrepositories.3F
If there's a better or built-in way to do this with Git tools, I'd like to
learn it, and I'd be happy to update the wiki accordingly.
Thanks,
Jon
--
Jon Jensen
End Point Corporation
http://www.endpoint.com/
^ permalink raw reply
* [PATCH] git submodule foreach: Provide access to submodule name, as '$name'
From: Johan Herland @ 2009-08-16 1:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List, Mark Levedahl, Lars Hjemli
The argument to 'git submodule foreach' already has access to the variables
'$path' (the path to the submodule, relative to the superproject) and '$sha1'
(the submodule commit recorded by the superproject).
This patch adds another variable -- '$name' -- which contains the name of the
submodule, as recorded in the superproject's .gitmodules file.
Signed-off-by: Johan Herland <johan@herland.net>
---
Documentation/git-submodule.txt | 3 ++-
git-submodule.sh | 1 +
2 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-submodule.txt b/Documentation/git-submodule.txt
index 7dd73ae..97c32fe 100644
--- a/Documentation/git-submodule.txt
+++ b/Documentation/git-submodule.txt
@@ -131,7 +131,8 @@ summary::
foreach::
Evaluates an arbitrary shell command in each checked out submodule.
- The command has access to the variables $path and $sha1:
+ The command has access to the variables $name, $path and $sha1:
+ $name is the name of the relevant submodule section in .gitmodules,
$path is the name of the submodule directory relative to the
superproject, and $sha1 is the commit as recorded in the superproject.
Any submodules defined in the superproject but not checked out are
diff --git a/git-submodule.sh b/git-submodule.sh
index ebed711..d8ecdb9 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -243,6 +243,7 @@ cmd_foreach()
if test -e "$path"/.git
then
say "Entering '$path'"
+ name=$(module_name "$path")
(cd "$path" && eval "$@") ||
die "Stopping at '$path'; script returned non-zero status."
fi
--
1.6.4.rc3.138.ga6b98.dirty
^ permalink raw reply related
* Re: [RFC PATCH 1/2] add a --delete option to git push
From: Sverre Rabbelier @ 2009-08-16 2:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jakub Narebski, Git List
In-Reply-To: <7vprax4yzd.fsf@alter.siamese.dyndns.org>
Heya,
On Fri, Aug 14, 2009 at 19:01, Junio C Hamano<gitster@pobox.com> wrote:
> As we discussed in this thread at length, #2 is on the borderline. It
> makes sense if you take only --delete out of possible vocabulary, but when
> you think about it as a part of a coherent whole, it becomes somewhat
> iffy---it does not fit particularly well with other parts of the system.
I do not particularly care either way, I'm willing to implement
whatever we decide on, and if that's nothing at all" that's fine with
me too :).
--
Cheers,
Sverre Rabbelier
^ permalink raw reply
* Re: Using VC build git (new patch)
From: Frank Li @ 2009-08-16 4:07 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, msysGit
In-Reply-To: <alpine.DEB.1.00.0908151908300.8306@pacific.mpi-cbg.de>
2009/8/16 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> Hi,
>
> On Sat, 15 Aug 2009, Johannes Schindelin wrote:
>
>> A single monster patch?
>>
>> Hmm.
>>
>> Please understand that I will not review that unless it is split up into
>> nice little and reviewable chunks.
>
> Well, I try to improve.
>
> So I had a look at your patch. The changes fall naturally into one of the
> following categories:
>
> - decl-after-statement fixes
>
> - missing #include "git-compat-util.h"
>
> - converting a K&R style function definition to modern C
>
> - #undef's only needed for Microsoft Visual C++
#undef ERROR is necessary.
#undef in mingw.h is only for clean some warning.
>
> - the addition of O_BINARY in the file modes
Yes, default is text mode if no O_BINARY, _read _write will
do union code and cr\cf convert.
>
> - disabling link() (why?)
VC report stack error. I also don't know why.
I have not deep debug this problem.
>
> - double-#define'ing stat (which puzzles me greatly)
old define is
#define stat stati64
#define stati64 msys_stati64.
stat is used for both struct and function name.
In C code:
struct stat a;
stat -> stati64 -> msys_stati64, so compiler report struct
msys_stati64 have not defined.
>
> - dummy #define'ing of a few compiler attributes
>
> - adding _MSVC to a conditional to avoid #define'ing
> SNPRINTF_SIZE_CORR yourself
>
> - #define'ing several symbols without leading underscore to the
> MS-specific version with a leading underscore
>
> - implementing strcasecmp() in a misnamed file
>
> - "fixing" the return value of winansi_vfprintf for Microsoft
> Visual C++ (I think this fix is wrong)
>
> - correctly adding a Visual C++-specific conditional to
> git-compat-util.h, pager.c, run-command.c, run-command.h,
> setup.c and help.c, although the latter five could use some
> refactoring into git-compat-util.h
Do you means add
#ifdef _MSC_VER
#include git-compat-util.h
#endif
>
> Maybe there is also room to change the MinGW-conditional into a
> NO_TRUSTABLE_FILEMODE one
>
> - adding several headers missing from Visual C++'s installation
>
> - adding _huge_ .vcproj files (can they not be smaller?)
It is created by VS2008. I think it is difficult to make smaller.
>
> As you can see, there is a pretty natural way to split that huge patch
> into chunks that most people on these lists can review easily, and that
> would actually be a pleasure to look at.
>
> Even better, there are a few fixes (the first three, if you ask me), which
> are not even Windows-specific.
>
> Further, I would like to suggest adding a header file compat/msvc.h which
> contains all the #undef's and #define's necessary only for Visual C++, and
> which can be #include'd from git-compat-util.h, to better separate your
> work from the other platforms (who do not want those changes). That
> should avoid those unwanted changes to mingw.c and mingw.h. You just have
> to make sure that msvc.h is #include'd before mingw.h.
VC build will reuse msysgit work.
I will reduce change to mingw.c and mingw.h
But there are some problem at mingw.c and mingw.h
1. stat defination. Because both struct and function use the same name stat.
2. open need binary mode.
3. mingw.c use C99 style to break build at VC.
4. mingw.c use special DIR structure, So I need add open_dir in mingw.c.
If I don't change mingw.c, I need copy it to new file totally.
>
> With these comments, I look forward to your next iteration.
>
> Ciao,
> Dscho
>
>
>
>
^ permalink raw reply
* [PATCH] unpack-trees.c: simplify check_updates() code path when o->update is false
From: Nguyễn Thái Ngọc Duy @ 2009-08-16 5:05 UTC (permalink / raw)
To: Junio C Hamano, git; +Cc: Nguyễn Thái Ngọc Duy
check_updates() is heavily branched by o->update, which makes it quite
difficult to follow. This patch rips "o->update == 0" code path out and
put it on top.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
unpack-trees.c | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/unpack-trees.c b/unpack-trees.c
index 720f7a1..3ee9919 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -75,7 +75,15 @@ static int check_updates(struct unpack_trees_options *o)
int i;
int errs = 0;
- if (o->update && o->verbose_update) {
+ if (!o->update) {
+ remove_marked_cache_entries(&o->result);
+ remove_scheduled_dirs();
+ for (i = 0; i < index->cache_nr; i++)
+ index->cache[i]->ce_flags &= ~CE_UPDATE;
+ return 0;
+ }
+
+ if (o->verbose_update) {
for (total = cnt = 0; cnt < index->cache_nr; cnt++) {
struct cache_entry *ce = index->cache[cnt];
if (ce->ce_flags & (CE_UPDATE | CE_REMOVE))
@@ -87,15 +95,13 @@ static int check_updates(struct unpack_trees_options *o)
cnt = 0;
}
- if (o->update)
- git_attr_set_direction(GIT_ATTR_CHECKOUT, &o->result);
+ git_attr_set_direction(GIT_ATTR_CHECKOUT, &o->result);
for (i = 0; i < index->cache_nr; i++) {
struct cache_entry *ce = index->cache[i];
if (ce->ce_flags & CE_REMOVE) {
display_progress(progress, ++cnt);
- if (o->update)
- unlink_entry(ce);
+ unlink_entry(ce);
}
}
remove_marked_cache_entries(&o->result);
@@ -107,14 +113,11 @@ static int check_updates(struct unpack_trees_options *o)
if (ce->ce_flags & CE_UPDATE) {
display_progress(progress, ++cnt);
ce->ce_flags &= ~CE_UPDATE;
- if (o->update) {
- errs |= checkout_entry(ce, &state, NULL);
- }
+ errs |= checkout_entry(ce, &state, NULL);
}
}
stop_progress(&progress);
- if (o->update)
- git_attr_set_direction(GIT_ATTR_CHECKIN, NULL);
+ git_attr_set_direction(GIT_ATTR_CHECKIN, NULL);
return errs != 0;
}
--
1.6.3.GIT
^ permalink raw reply related
* Re: [RFC PATCH v3 8/8] --sparse for porcelains
From: Johannes Schindelin @ 2009-08-16 8:14 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Junio C Hamano, Nguyen Thai Ngoc Duy, git
In-Reply-To: <200908160137.30384.jnareb@gmail.com>
Hi,
On Sun, 16 Aug 2009, Jakub Narebski wrote:
> On Sat, 15 Aug 2009, Junio C Hamano wrote:
> > Jakub Narebski <jnareb@gmail.com> writes:
> >
> >>>> Hmmm... this looks like either argument for introducing --full
> >>>> option to git-checkout (ignore CE_VALID bit, checkout everything,
> >>>> and clean CE_VALID (?))...
> >>>>
> >>>> ...or for going with _separate_ bit for partial checkout, like in
> >>>> the very first version of this series, which otherwise functions
> >>>> like CE_VALID, or is just used to mark that CE_VALID was set using
> >>>> sparse.
> >
> > How would a separate bit help? Just like you need to clear CE_VALID
> > bit to revert the index into a normal (or "non sparse") state somehow,
> > you would need to have a way to clear that separate bit anyway.
> >
> > A separate bit would help only if you want to handle assume-unchanged
> > and sparse checkout independently. But my impression was that the
> > recent lstat reduction effort addressed the issue assume-unchanged
> > were invented to work around in the first place.
>
> Well, if we assume that we don't need (don't want) to handle
> assume-unchanged and sparse checkout independently, then of course the
> idea of having separate or additional bit for sparse doesn't make sense.
For the shallow/graft issue, we had a similar discussion. Back then, I
was convinced that shallow commits and grafted commits were something
fundamentally different, and my recent patch to pack-objects shows that:
shallow commits do not have the real parents in the current repository,
and that makes them different from other grafted commits.
Now, if you want to say that assume-unchanged and sparse are two
fundamentally different things, I would be interested in some equally
convincing argument as for the shallow/graft issue.
There is a fundamental difference, I grant you that: the working directory
does not contain the "sparse'd away" files while the same is not true for
assume-unchanged files.
But does that matter? The corresponding files are still in the index and
the repository.
IOW under what circumstances would you want to be able to discern between
assume-unchanged and "sparse'd away" files in the working directory?
I could _imagine_ that you'd want a tool that allows you to change the
focus of the sparse checkout together with the working directory.
Example: you have a sparse checkout of Documentation/ and now you want to
have t/, too. Just changing .git/info/sparse will not be enough.
The question is if the tool to change the "sparseness" [*1*] should not
change .git/info/sparse itself; if it does not, it would be good to be
able to discern between the "assume-unchanged" and "sparse'd away" files.
Although it might be enough to traverse the index and check the presence
of the assume-unchanged files in the working directory to determine which
files are sparse, and which ones are merely assume-unchanged.
Ciao,
Dscho
Footnote [*1*]: I think we need some nice and clear nomenclature here.
Any English wizards with a good taste of naming things?
^ permalink raw reply
* Re: Using VC build git (new patch)
From: Johannes Schindelin @ 2009-08-16 8:38 UTC (permalink / raw)
To: Frank Li; +Cc: git, msysGit
In-Reply-To: <1976ea660908152107s8b8f3e5l3c2f043fb3e4d62@mail.gmail.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 4438 bytes --]
Hi,
[please quote only those parts that you actually reply to.]
On Sun, 16 Aug 2009, Frank Li wrote:
> 2009/8/16 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > - the addition of O_BINARY in the file modes
>
> Yes, default is text mode if no O_BINARY, _read _write will do union
> code and cr\cf convert.
As Git _never_ wants to open files in text mode, this is a change that can
come _separately_ from your VC patches. It could even be considered a bug
fix (MinGW's current GCC implies O_BINARY, but previous ones may not, and
it is wrong of us to rely on this magic).
> > - disabling link() (why?)
>
> VC report stack error. I also don't know why. I have not deep debug this
> problem.
You should. What with Visual Studio's superior debugging capabilities, it
should not be a problem. Right?
> > - double-#define'ing stat (which puzzles me greatly)
>
> old define is
> #define stat stati64
> #define stati64 msys_stati64.
Not exactly.
#define stat _stati64
[...]
#define _stati64(x,y) mingw_lstat(x,y)
And even VC should handle that just fine.
> stat is used for both struct and function name.
> In C code:
> struct stat a;
> stat -> stati64 -> msys_stati64, so compiler report struct
> msys_stati64 have not defined.
It is a real pity that you did not inline your patch, and that I could not
quote it as a consequence, because now we could discuss code properly:
The original code was done on purpose as it is, to use the _stati64 struct
(which allows long pointers, as Microsoft decided off_t was not good
enough to represent 64 bit offsets). I could imagine that your patch
breaks that for Visual C++.
> > - adding _huge_ .vcproj files (can they not be smaller?)
>
> It is created by VS2008. I think it is difficult to make smaller.
Is there not some magic to make a compact export version?
But maybe it is not that bad? I have 72 (out of 1730) files in my
repository that are larger, gitk being the king.
FWIW I would have loved it if _you_ defended the size of the file, instead
of having to do it myself.
> > Further, I would like to suggest adding a header file compat/msvc.h
> > which contains all the #undef's and #define's necessary only for
> > Visual C++, and which can be #include'd from git-compat-util.h, to
> > better separate your work from the other platforms (who do not want
> > those changes). That should avoid those unwanted changes to mingw.c
> > and mingw.h. You just have to make sure that msvc.h is #include'd
> > before mingw.h.
>
> VC build will reuse msysgit work.
That is no question. We made it easy for you.
> I will reduce change to mingw.c and mingw.h
> But there are some problem at mingw.c and mingw.h
>
> 1. stat defination. Because both struct and function use the same name stat.
That needs to be resolved somehow, and you would get _much_ more help if
you had split your patch series properly and this was _one_ patch.
> 2. open need binary mode.
As I said, this can be a separate change. In my original reply I
_implied_ that it is okay, and in this reply I elaborated on that (namely
that it might be considered a bug fix).
> 3. mingw.c use C99 style to break build at VC.
The same applies here as to O_BINARY.
> 4. mingw.c use special DIR structure, So I need add open_dir in mingw.c.
No, you do not need to add that to mingw.c. MinGW does not need it. So
it has no place in mingw.c.
> If I don't change mingw.c, I need copy it to new file totally.
NOOOO!!!
You #include it after making sure that you have #undef'ed and #define'd
whatever needs to, and in a separate file -- which is only referenced in
the .vcproj -- you can implement whatever Visual C++ misses.
> > With these comments, I look forward to your next iteration.
> >
> > Ciao,
> > Dscho
Please, please, PLEASE, do not quote things that you are not addressing.
And please, please, PLEASE adher to Documentation/SubmittingPatches.
Actually, the only thing SubmittingPatches does is spell out how to make
things easier for reviewers, should you not know how to do so.
Remember: the more time it takes me to cull the quoted parts of your mail,
the more time it takes me to have a look at your patches, the more time it
takes me to refer to your patch and make suggestions, the more am I
inclined to spend my time elsewhere, doing something that is much more
enjoyable.
Ciao,
Dscho
^ permalink raw reply
* Re: How to stop sharing objects between repositories
From: Johannes Schindelin @ 2009-08-16 8:43 UTC (permalink / raw)
To: Jon Jensen; +Cc: git
In-Reply-To: <alpine.DEB.2.00.0908151756150.29215@nhtr.ovalna.fjrygre.arg>
Hi,
On Sat, 15 Aug 2009, Jon Jensen wrote:
> If there's a better or built-in way to do this with Git tools, I'd like
> to learn it, and I'd be happy to update the wiki accordingly.
I think what you need is done by
git repack -l
(I agree it is not well documented, and I'd welcome a documentation
patch.)
Ciao,
Dscho
^ permalink raw reply
* Re: [RFC PATCH 1/2] add a --delete option to git push
From: Jakub Narebski @ 2009-08-16 9:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Sverre Rabbelier, Git List
In-Reply-To: <7vprax4yzd.fsf@alter.siamese.dyndns.org>
On Sat, 15 Aug 2009, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
> > One more thing. I suspect that adding --delete and nothing else probably
> > makes things worse than not doing anything.
I don't necessarily agree with that. Having '--delete=<dst>' being long
version equivalent of ':<dst>' doesn't in my opinion change parading
used by git-push to the "<scm> push <operation> <refs>..." paradigm used
by Mercurial.
It's just a convenience syntax sugar: have more readable but longer
version. Just like equivalent short and long options.
BTW. there are few other places where git is TMTOWDI...
> > In a mental model where "push there --delete $branch" is natural, there
> > are branches on the other side, and when you run 'push' command, you name
> > the special operation, 'delete', that you would want to inflict on them.
> >
> > In such a world, there probably are other (perhaps not so special)
> > operations you can inflict on the branches on the other side as well.
> > They are probably called something like:
> >
> > push there --create $branch $commit
> > push there --update $branch $commit
> >
> > If you give them only --delete without completing the vocabulary by giving
> > these operations as well, you would force people to mix "git native" world
> > model (i.e. there is no "mode" nor "opration"; there is only "list of
> > instructions, each of which encodes the equivalent of 'mode'") with this
> > Hg-inspired world model.
>
> One final note on this topic. A more problematic is --rename.
>
> In the "there are branches on the other side, and a push command can be
> told to operate on them in different ways" world model, you naturally
> would want to:
>
> push there --delete $branch
> push there --rename $old $new
> push there --copy $old $new
>
> The first one you can implement as a syntax sugar by turning it into the
> native way of pushing ":$branch". You however cannot shoehorn rename and
> copy, because the way in which git push works does not have direct access
> to their "original" values of remote branches. If we do not have the
> current object $old points at, you cannot emulate "rename $old $new" nor
> "copy $old $new" only with simple syntax sugarcoating. We would likely
> need a protocol extension to fit them in, and that is of dubious value.
True. I'm against introducing "<scm> push <remote> <operation> <refs>"
paradigm.
If you think that '--delete=<dst>' for ':<dst>' would cause too much
confusion...
>
> Among the ones Jakub listed in another message:
http://nubyonrails.com/articles/five-features-from-mercurial-that-would-make-git-suck-less
> 1. "<scm> init <directory>" (done)
> 2. "hg commit --close-branch" vs slightly cryptic
> "git push origin :refs/heads/feature-tweak", which can be written
> simply as "git push origin :feature-tweak" I think.
> (that is what this patch series is about)
> 3. Numeric local references, e.g. 18:a432bc and "hg checkout 18"...
> but more realistic example would be "hg checkout 6324" :-P
> 4. sensible defaults: meaning of revert, staging area (i.e. commit -a)
> 5. "hg serve" (gitweb and a kind of git-daemon equivalent)
Note that I didn't said that I have agree with those points (as you can
see with comment to #3 for example), and I did say to read original
blog post instead of relying on this bare-bones summary.
>
> I think only #1 and #5 make sense (and I wonder if it would be enough to
> mention "instaweb" and "daemon" to cover #5).
I think #5 is also about native transport over HTTP, i.e. the "smart"
HTTP protocol idea (which didn't pass protocol design stage, AFAIK
no code).
>
> As we discussed in this thread at length, #2 is on the borderline. It
> makes sense if you take only --delete out of possible vocabulary, but when
> you think about it as a part of a coherent whole, it becomes somewhat
> iffy---it does not fit particularly well with other parts of the system.
I can agree that #2 is borderline and a bit problematic (when one is in
the mood for bikeshedding at least ;-))).
>
> I think #3 and #4 comes from fundamental difference of the world views.
>
> Regarding #3, giving monotonically increasing numbers to local commits
> would not be very hard without breaking the underlying data model. You
> would automatically tag the original commit whenever a new branch is
> created, and count commits relative to that origin-point tag for the
> current branch, perhaps following only the first parent chain, or
> something like that.
>
> For such a incrementing number be any useful, the user's history should
> rarely rewind, and this also introduces a notion/illusion that a branch
> somehow has its own identity, which we deliberately have rejected. I doubt
> this is worth it. Most of the time you are interested in the recent past,
> and HEAD~14 would be far easier to use than r19354 anyway ;-)
Also there is a matter of fast-forward merges that git use, which
I think is against 'branch have identity' idea.
On the other side there was considered adding 'generation' header
generation(this) = max(generation(this.parents)) + 1
which was intended to help speed up traversal, but it was decided it
was not worth the hassle to add such commit object header to existing
repository which do not use it. There was idea to put it in cache,
as it is recalculable, but that idea was never put into code.
>
> About #4, in general, I do not think it is worth discussing a topic that
> begins with the word "sensible" when the person who uses that word does
> not realize that what is sensible is in the eyes of beholder. Different
> SCMs use "revert" to mean different things, because there are a lot of
> combinations of _things_ you would want to revert, _states_ you would want
> to revert to, and _ways_ you would want the revert to be expressed. You
> may be familiar with the way BK used the word revert, or you may be
> familiar with the way SVN used the word revert. There is no single
> "right" use of the word.
>
> It also is not worth repeating the discussion on fear of index, either.
IHMO the very minor disadvantage of having to specify "git commit -a"
with '-a' option in usual case is well worth it when you need more
complicated staging / index manipulation, e.g. during more involved
merging.
>
> This is a good example of why you should _think_ before blindly parrotting
> whatever random people say on the net. They have not necessarily thought
> things through before saying "git can learn from X". You need to do the
> thinking for them to decide if they are making any sense when you read
> these things.
I was just listing what he said ;-)
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH] Enable Visual Studio 2008 Build Git
From: Dmitry Potapov @ 2009-08-16 10:49 UTC (permalink / raw)
To: Frank Li; +Cc: Johannes Schindelin, git
Hi,
In addition to what Johannes wrote above, I have a few more remarks:
On Tue, Aug 04, 2009 at 11:53:38PM +0800, Frank Li wrote:
> diff --git a/compat/mingw.c b/compat/mingw.c
[...]
> @@ -1011,7 +1021,9 @@ static sig_handler_t timer_fn = SIG_DFL;
> * But ticktack() interrupts the wait state after the timer's interval
> * length to call the signal handler.
> */
> -
> +#if defined(_MSC_VER)
> +#define __stdcall
> +#endif
It is a very dirty hack to change __stdcall in this way, and more
importantly, it is not clear why you did this.
> static __stdcall unsigned ticktack(void *dummy)
Accordingly to MSDN:
http://msdn.microsoft.com/en-us/library/kdzttdcb(VS.80).aspx
The routine given to _beginthreadex as the start address should be
either __stdcall or __clrcall.
> --- /dev/null
> +++ b/compat/vcbuild/libgit/libgit.vcproj
[...]
> + <Filter
> + Name="compat"
> + >
> + <File
> + RelativePath="..\..\..\compat\basename.c"
> + >
> + </File>
> + <File
> + RelativePath="..\..\..\compat\cygwin.h"
> + >
> + </File>
I am not sure what cygwin.h is doing here.
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 9f941e4..3b683e6 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -87,7 +87,7 @@
> #include <assert.h>
> #include <regex.h>
> #include <utime.h>
> -#ifndef __MINGW32__
> +#if !defined(__MINGW32__) && !defined(_MSC_VER)
IMHO, it should be:
#ifndef _WIN32
because it has nothing to do with a particular compiler but with the
target platform. (Note: Cygwin GCC does not have _WIN32 defined, but
MinGW GCC does, so it should not break anything.)
Dmitry
^ permalink raw reply
* Re: How to stop sharing objects between repositories
From: Jeff King @ 2009-08-16 12:28 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jon Jensen, git
In-Reply-To: <alpine.DEB.1.00.0908161042210.8306@pacific.mpi-cbg.de>
On Sun, Aug 16, 2009 at 10:43:11AM +0200, Johannes Schindelin wrote:
> > If there's a better or built-in way to do this with Git tools, I'd like
> > to learn it, and I'd be happy to update the wiki accordingly.
>
> I think what you need is done by
>
> git repack -l
>
> (I agree it is not well documented, and I'd welcome a documentation
> patch.)
I think it is the opposite; packing _without_ "-l" will create a pack
with objects from the alternate; using "-l" suppresses them. Running
"git repack -a" should do the trick, I believe (and you need the "-a" to
ensure that objects already packed in the repo are re-packed).
-Peff
^ permalink raw reply
* Re: How to stop sharing objects between repositories
From: Johannes Schindelin @ 2009-08-16 12:30 UTC (permalink / raw)
To: Jeff King; +Cc: Jon Jensen, git
In-Reply-To: <20090816122842.GA942@sigill.intra.peff.net>
Hi,
On Sun, 16 Aug 2009, Jeff King wrote:
> On Sun, Aug 16, 2009 at 10:43:11AM +0200, Johannes Schindelin wrote:
>
> > > If there's a better or built-in way to do this with Git tools, I'd like
> > > to learn it, and I'd be happy to update the wiki accordingly.
> >
> > I think what you need is done by
> >
> > git repack -l
> >
> > (I agree it is not well documented, and I'd welcome a documentation
> > patch.)
>
> I think it is the opposite; packing _without_ "-l" will create a pack
> with objects from the alternate; using "-l" suppresses them. Running
> "git repack -a" should do the trick, I believe (and you need the "-a" to
> ensure that objects already packed in the repo are re-packed).
Hmm. I really would like a documentation patch, then.
Ciao,
Dscho
^ permalink raw reply
* Re: How to stop sharing objects between repositories
From: Daniel Villeneuve @ 2009-08-16 13:54 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Jeff King, Jon Jensen, git
In-Reply-To: <alpine.DEB.1.00.0908161429590.8306@pacific.mpi-cbg.de>
Johannes Schindelin wrote:
> Hmm. I really would like a documentation patch, then.
>
>
As another way to do it, I've used something along the lines from
http://article.gmane.org/gmane.comp.version-control.git/62062
namely:
<script>
gitdir=$(git rev-parse --git-dir)
[ -n "$gitdir" ] || die "cannot find Git directory"
cd "$gitdir"
a=objects/info/alternates
if [ -f $a ]; then
git rev-parse --all HEAD | git pack-objects --revs objects/pack/pack
rm $a
fi
</script>
I was not sure HEAD would be included via --all (e.g. HEAD pointing to a
dangling commit), so I added it explicitly.
The reverse operation (enabling sharing for a standalone repository) is
described here
http://git.or.cz/gitwiki/GitFaq#Howtoshareobjectsbetweenexistingrepositories.3F
--
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