aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-12-21 23:01:45 -0800
committerJunio C Hamano <junkio@cox.net>2006-12-21 23:01:45 -0800
commit90cee090a0d7f950130d50df123551e43843e679 (patch)
treee66cfbfe0f204cd197ad3fef14ef339b828892b7
parent4264dc15e198bf9e9a2bb4ee897dd8e3eaabca47 (diff)
parentfa39b6b5b11f9b580c515a7b4a8e4eb8eaa79b75 (diff)
downloadgit-90cee090a0d7f950130d50df123551e43843e679.tar.gz
git-90cee090a0d7f950130d50df123551e43843e679.tar.xz
Merge branch 'master' into jc/fsck-reflog
* master: Introduce a global level warn() function. Rename imap-send's internal info/warn functions. _XOPEN_SOURCE problem also exists on FreeBSD parse-remote: mark all refs not for merge only when fetching more than one git-reset --hard: tell the user what the HEAD was reset to git-tag: support -F <file> option Revert "git-pull: refuse default merge without branch.*.merge" Suggest 'add' in am/revert/cherry-pick. Use git-merge-file in git-merge-one-file, too diff --check: fix off by one error Documentation/git-branch: new -r to delete remote-tracking branches. Fix system header problems on Mac OS X spurious .sp in manpages
-rw-r--r--Documentation/git-branch.txt13
-rw-r--r--Documentation/git-tag.txt6
-rw-r--r--diff.c4
-rwxr-xr-xgit-am.sh4
-rw-r--r--git-compat-util.h4
-rwxr-xr-xgit-merge-one-file.sh2
-rwxr-xr-xgit-parse-remote.sh14
-rwxr-xr-xgit-reset.sh7
-rwxr-xr-xgit-revert.sh2
-rwxr-xr-xgit-tag.sh11
-rw-r--r--imap-send.c24
-rw-r--r--usage.c19
12 files changed, 81 insertions, 29 deletions
diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt
index 71417feba..c464bd2fd 100644
--- a/Documentation/git-branch.txt
+++ b/Documentation/git-branch.txt
@@ -11,7 +11,7 @@ SYNOPSIS
'git-branch' [-r | -a] [-v [--abbrev=<length>]]
'git-branch' [-l] [-f] <branchname> [<start-point>]
'git-branch' (-m | -M) [<oldbranch>] <newbranch>
-'git-branch' (-d | -D) <branchname>...
+'git-branch' (-d | -D) [-r] <branchname>...
DESCRIPTION
-----------
@@ -33,7 +33,8 @@ to happen.
With a `-d` or `-D` option, `<branchname>` will be deleted. You may
specify more than one branch for deletion. If the branch currently
-has a ref log then the ref log will also be deleted.
+has a ref log then the ref log will also be deleted. Use -r together with -d
+to delete remote-tracking branches.
OPTIONS
@@ -60,7 +61,7 @@ OPTIONS
Move/rename a branch even if the new branchname already exists.
-r::
- List the remote-tracking branches.
+ List or delete (if used with -d) the remote-tracking branches.
-a::
List both remote-tracking branches and local branches.
@@ -111,10 +112,12 @@ Delete unneeded branch::
------------
$ git clone git://git.kernel.org/.../git.git my.git
$ cd my.git
-$ git branch -D todo <1>
+$ git branch -d -r todo html man <1>
+$ git branch -D test <2>
------------
+
-<1> delete todo branch even if the "master" branch does not have all
+<1> delete remote-tracking branches "todo", "html", "man"
+<2> delete "test" branch even if the "master" branch does not have all
commits from todo branch.
diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
index 45476c2e4..48b82b86f 100644
--- a/Documentation/git-tag.txt
+++ b/Documentation/git-tag.txt
@@ -9,7 +9,8 @@ git-tag - Create a tag object signed with GPG
SYNOPSIS
--------
[verse]
-'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg>] <name> [<head>]
+'git-tag' [-a | -s | -u <key-id>] [-f | -d] [-m <msg> | -F <file>]
+ <name> [<head>]
'git-tag' -l [<pattern>]
DESCRIPTION
@@ -60,6 +61,9 @@ OPTIONS
-m <msg>::
Use the given tag message (instead of prompting)
+-F <file>::
+ Take the tag message from the given file. Use '-' to
+ read the message from the standard input.
Author
------
diff --git a/diff.c b/diff.c
index 91f956b23..f14288bb8 100644
--- a/diff.c
+++ b/diff.c
@@ -860,8 +860,6 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (line[0] == '+') {
int i, spaces = 0;
- data->lineno++;
-
/* check space before tab */
for (i = 1; i < len && (line[i] == ' ' || line[i] == '\t'); i++)
if (line[i] == ' ')
@@ -876,6 +874,8 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
if (isspace(line[len - 1]))
printf("%s:%d: white space at end: %.*s\n",
data->filename, data->lineno, (int)len, line);
+
+ data->lineno++;
} else if (line[0] == ' ')
data->lineno++;
else if (line[0] == '@') {
diff --git a/git-am.sh b/git-am.sh
index 5df6787a3..0126a77b9 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -401,14 +401,14 @@ do
changed="$(git-diff-index --cached --name-only HEAD)"
if test '' = "$changed"
then
- echo "No changes - did you forget update-index?"
+ echo "No changes - did you forget to use 'git add'?"
stop_here_user_resolve $this
fi
unmerged=$(git-ls-files -u)
if test -n "$unmerged"
then
echo "You still have unmerged paths in your index"
- echo "did you forget update-index?"
+ echo "did you forget to use 'git add'?"
stop_here_user_resolve $this
fi
apply_status=0
diff --git a/git-compat-util.h b/git-compat-util.h
index bc296b3a4..a55b92389 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -11,8 +11,10 @@
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
+#if !defined(__APPLE__) && !defined(__FreeBSD)
#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
#define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
+#endif
#define _GNU_SOURCE
#define _BSD_SOURCE
@@ -69,10 +71,12 @@
extern void usage(const char *err) NORETURN;
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
+extern void warn(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void set_usage_routine(void (*routine)(const char *err) NORETURN);
extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
extern void set_error_routine(void (*routine)(const char *err, va_list params));
+extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
#ifdef NO_MMAP
diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
index c49e4c65a..7d62d7902 100755
--- a/git-merge-one-file.sh
+++ b/git-merge-one-file.sh
@@ -104,7 +104,7 @@ case "${1:-.}${2:-.}${3:-.}" in
# Be careful for funny filename such as "-L" in "$4", which
# would confuse "merge" greatly.
src1=`git-unpack-file $2`
- merge "$src1" "$orig" "$src2"
+ git-merge-file "$src1" "$orig" "$src2"
ret=$?
# Create the working tree file, using "our tree" version from the
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index ea7511e8a..f163821d0 100755
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -136,16 +136,22 @@ canon_refs_list_for_fetch () {
if test "$1" = "-d"
then
shift ; remote="$1" ; shift
+ set x $(expand_refs_wildcard "$@")
+ shift
if test "$remote" = "$(get_default_remote)"
then
curr_branch=$(git-symbolic-ref HEAD | \
sed -e 's|^refs/heads/||')
merge_branches=$(git-repo-config \
- --get-all "branch.${curr_branch}.merge") ||
- merge_branches=.this.would.never.match.any.ref.
+ --get-all "branch.${curr_branch}.merge")
+ fi
+ # If we are fetching only one branch, then first branch
+ # is the only thing that makes sense to merge anyway,
+ # so there is no point refusing that traditional rule.
+ if test $# != 1 && test "z$merge_branches" = z
+ then
+ merge_branches=..this..would..never..match..
fi
- set x $(expand_refs_wildcard "$@")
- shift
fi
for ref
do
diff --git a/git-reset.sh b/git-reset.sh
index 8d95e3748..2379db082 100755
--- a/git-reset.sh
+++ b/git-reset.sh
@@ -86,7 +86,12 @@ update_ref_status=$?
case "$reset_type" in
--hard )
- ;; # Nothing else to do
+ test $update_ref_status = 0 && {
+ echo -n "HEAD is now at "
+ GIT_PAGER= git log --max-count=1 --pretty=oneline \
+ --abbrev-commit HEAD
+ }
+ ;;
--soft )
;; # Nothing else to do
--mixed )
diff --git a/git-revert.sh b/git-revert.sh
index 6eab3c72d..50cc47b06 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -155,7 +155,7 @@ Conflicts:
uniq
} >>"$GIT_DIR/MERGE_MSG"
echo >&2 "Automatic $me failed. After resolving the conflicts,"
- echo >&2 "mark the corrected paths with 'git-update-index <paths>'"
+ echo >&2 "mark the corrected paths with 'git-add <paths>'"
echo >&2 "and commit the result."
case "$me" in
cherry-pick)
diff --git a/git-tag.sh b/git-tag.sh
index d53f94cd9..36cd6aa25 100755
--- a/git-tag.sh
+++ b/git-tag.sh
@@ -45,6 +45,17 @@ do
message_given=1
fi
;;
+ -F)
+ annotate=1
+ shift
+ if test "$#" = "0"; then
+ die "error: option -F needs an argument"
+ exit 2
+ else
+ message="$(cat "$1")"
+ message_given=1
+ fi
+ ;;
-u)
annotate=1
signed=1
diff --git a/imap-send.c b/imap-send.c
index 894cbbdf5..ad91858bc 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -96,8 +96,8 @@ typedef struct {
static int Verbose, Quiet;
-static void info( const char *, ... );
-static void warn( const char *, ... );
+static void imap_info( const char *, ... );
+static void imap_warn( const char *, ... );
static char *next_arg( char ** );
@@ -297,7 +297,7 @@ buffer_gets( buffer_t * b, char **s )
}
static void
-info( const char *msg, ... )
+imap_info( const char *msg, ... )
{
va_list va;
@@ -310,7 +310,7 @@ info( const char *msg, ... )
}
static void
-warn( const char *msg, ... )
+imap_warn( const char *msg, ... )
{
va_list va;
@@ -903,7 +903,7 @@ imap_open_store( imap_server_conf_t *srvc )
/* open connection to IMAP server */
if (srvc->tunnel) {
- info( "Starting tunnel '%s'... ", srvc->tunnel );
+ imap_info( "Starting tunnel '%s'... ", srvc->tunnel );
if (socketpair( PF_UNIX, SOCK_STREAM, 0, a )) {
perror( "socketpair" );
@@ -926,31 +926,31 @@ imap_open_store( imap_server_conf_t *srvc )
imap->buf.sock.fd = a[1];
- info( "ok\n" );
+ imap_info( "ok\n" );
} else {
memset( &addr, 0, sizeof(addr) );
addr.sin_port = htons( srvc->port );
addr.sin_family = AF_INET;
- info( "Resolving %s... ", srvc->host );
+ imap_info( "Resolving %s... ", srvc->host );
he = gethostbyname( srvc->host );
if (!he) {
perror( "gethostbyname" );
goto bail;
}
- info( "ok\n" );
+ imap_info( "ok\n" );
addr.sin_addr.s_addr = *((int *) he->h_addr_list[0]);
s = socket( PF_INET, SOCK_STREAM, 0 );
- info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) );
+ imap_info( "Connecting to %s:%hu... ", inet_ntoa( addr.sin_addr ), ntohs( addr.sin_port ) );
if (connect( s, (struct sockaddr *)&addr, sizeof(addr) )) {
close( s );
perror( "connect" );
goto bail;
}
- info( "ok\n" );
+ imap_info( "ok\n" );
imap->buf.sock.fd = s;
@@ -979,7 +979,7 @@ imap_open_store( imap_server_conf_t *srvc )
if (!preauth) {
- info ("Logging in...\n");
+ imap_info ("Logging in...\n");
if (!srvc->user) {
fprintf( stderr, "Skipping server %s, no user\n", srvc->host );
goto bail;
@@ -1006,7 +1006,7 @@ imap_open_store( imap_server_conf_t *srvc )
fprintf( stderr, "Skipping account %s@%s, server forbids LOGIN\n", srvc->user, srvc->host );
goto bail;
}
- warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
+ imap_warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
if (imap_exec( ctx, NULL, "LOGIN \"%s\" \"%s\"", srvc->user, srvc->pass ) != RESP_OK) {
fprintf( stderr, "IMAP error: LOGIN failed\n" );
goto bail;
diff --git a/usage.c b/usage.c
index 52c2e9605..4dc5c7763 100644
--- a/usage.c
+++ b/usage.c
@@ -29,12 +29,17 @@ static void error_builtin(const char *err, va_list params)
report("error: ", err, params);
}
+static void warn_builtin(const char *warn, va_list params)
+{
+ report("warning: ", warn, params);
+}
/* If we are in a dlopen()ed .so write to a global variable would segfault
* (ugh), so keep things static. */
static void (*usage_routine)(const char *err) NORETURN = usage_builtin;
static void (*die_routine)(const char *err, va_list params) NORETURN = die_builtin;
static void (*error_routine)(const char *err, va_list params) = error_builtin;
+static void (*warn_routine)(const char *err, va_list params) = warn_builtin;
void set_usage_routine(void (*routine)(const char *err) NORETURN)
{
@@ -51,6 +56,11 @@ void set_error_routine(void (*routine)(const char *err, va_list params))
error_routine = routine;
}
+void set_warn_routine(void (*routine)(const char *warn, va_list params))
+{
+ warn_routine = routine;
+}
+
void usage(const char *err)
{
@@ -75,3 +85,12 @@ int error(const char *err, ...)
va_end(params);
return -1;
}
+
+void warn(const char *warn, ...)
+{
+ va_list params;
+
+ va_start(params, warn);
+ warn_routine(warn, params);
+ va_end(params);
+}