Skip to content

Commit

Permalink
Merge with git://kernel.org/pub/scm/git/git.git
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Langhoff committed May 3, 2006
2 parents e660e39 + 782b3b6 commit 24e1257
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 63 deletions.
76 changes: 63 additions & 13 deletions Documentation/git-rebase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,54 @@ git-rebase(1)

NAME
----
git-rebase - Rebase local commits to new upstream head
git-rebase - Rebase local commits to a new head

SYNOPSIS
--------
'git-rebase' [--onto <newbase>] <upstream> [<branch>]

'git-rebase' --continue

'git-rebase' --abort

DESCRIPTION
-----------
git-rebase applies to <upstream> (or optionally to <newbase>) commits
from <branch> that do not appear in <upstream>. When <branch> is not
specified it defaults to the current branch (HEAD).
git-rebase replaces <branch> with a new branch of the same name. When
the --onto option is provided the new branch starts out with a HEAD equal
to <newbase>, otherwise it is equal to <upstream>. It then attempts to
create a new commit for each commit from the original <branch> that does
not exist in the <upstream> branch.

When git-rebase is complete, <branch> will be updated to point to the
newly created line of commit objects, so the previous line will not be
accessible unless there are other references to it already.
It is possible that a merge failure will prevent this process from being
completely automatic. You will have to resolve any such merge failure
and run `git rebase --continue`. If you can not resolve the merge
failure, running `git rebase --abort` will restore the original <branch>
and remove the working files found in the .dotest directory.

Note that if <branch> is not specified on the command line, the currently
checked out branch is used.

Assume the following history exists and the current branch is "topic":

------------
A---B---C topic
/
D---E---F---G master
------------

From this point, the result of either of the following commands:


git-rebase master
git-rebase master topic

would be:

------------
A'--B'--C' topic
/
D---E---F---G master
------------

While, starting from the same point, the result of either of the following
commands:
Expand All @@ -44,21 +60,33 @@ commands:

would be:

------------
A'--B'--C' topic
/
D---E---F---G master
------------

In case of conflict, git-rebase will stop at the first problematic commit
and leave conflict markers in the tree. After resolving the conflict manually
and updating the index with the desired resolution, you can continue the
rebasing process with
and leave conflict markers in the tree. You can use git diff to locate
the markers (<<<<<<) and make edits to resolve the conflict. For each
file you edit, you need to tell git that the conflict has been resolved,
typically this would be done with


git update-index <filename>


After resolving the conflict manually and updating the index with the
desired resolution, you can continue the rebasing process with


git rebase --continue

git am --resolved --3way

Alternatively, you can undo the git-rebase with

git reset --hard ORIG_HEAD
rm -r .dotest

git rebase --abort

OPTIONS
-------
Expand All @@ -73,6 +101,28 @@ OPTIONS
<branch>::
Working branch; defaults to HEAD.

--continue::
Restart the rebasing process after having resolved a merge conflict.

--abort::
Restore the original branch and abort the rebase operation.

NOTES
-----
When you rebase a branch, you are changing its history in a way that
will cause problems for anyone who already has a copy of the branch
in their repository and tries to pull updates from you. You should
understand the implications of using 'git rebase' on a repository that
you share.

When the git rebase command is run, it will first execute a "pre-rebase"
hook if one exists. You can use this hook to do sanity checks and
reject the rebase if it isn't appropriate. Please see the template
pre-rebase hook script for an example.

You must be in the top directory of your project to start (or continue)
a rebase. Upon completion, <branch> will be the current branch.

Author
------
Written by Junio C Hamano <junkio@cox.net>
Expand Down
1 change: 1 addition & 0 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extern const char *setup_git_directory(void);
extern const char *prefix_path(const char *prefix, int len, const char *path);
extern const char *prefix_filename(const char *prefix, int len, const char *path);
extern void verify_filename(const char *prefix, const char *name);
extern void verify_non_filename(const char *prefix, const char *name);

#define alloc_nr(x) (((x)+16)*3/2)

Expand Down
12 changes: 6 additions & 6 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ static char *parse_value(void)
space = 1;
continue;
}
if (!quote) {
if (c == ';' || c == '#') {
comment = 1;
continue;
}
}
if (space) {
if (len)
value[len++] = ' ';
Expand Down Expand Up @@ -93,12 +99,6 @@ static char *parse_value(void)
quote = 1-quote;
continue;
}
if (!quote) {
if (c == ';' || c == '#') {
comment = 1;
continue;
}
}
value[len++] = c;
}
}
Expand Down
26 changes: 23 additions & 3 deletions git-am.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ stop_here () {
exit 1
}

stop_here_user_resolve () {
cmdline=$(basename $0)
if test '' != "$interactive"
then
cmdline="$cmdline -i"
fi
if test '' != "$threeway"
then
cmdline="$cmdline -3"
fi
if test '.dotest' != "$dotest"
then
cmdline="$cmdline -d=$dotest"
fi
echo "When you have resolved this problem run \"$cmdline --resolved\"."
echo "If you would prefer to skip this patch, instead run \"$cmdline --skip\"."

stop_here $1
}

go_next () {
rm -f "$dotest/$msgnum" "$dotest/msg" "$dotest/msg-clean" \
"$dotest/patch" "$dotest/info"
Expand Down Expand Up @@ -374,14 +394,14 @@ do
if test '' = "$changed"
then
echo "No changes - did you forget update-index?"
stop_here $this
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?"
stop_here $this
stop_here_user_resolve $this
fi
apply_status=0
;;
Expand All @@ -407,7 +427,7 @@ do
if test $apply_status != 0
then
echo Patch failed at $msgnum.
stop_here $this
stop_here_user_resolve $this
fi

if test -x "$GIT_DIR"/hooks/pre-applypatch
Expand Down
16 changes: 12 additions & 4 deletions git-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,14 +270,22 @@ fetch_main () {
if [ -n "$GIT_SSL_NO_VERIFY" ]; then
curl_extra_args="-k"
fi
remote_name_quoted=$(perl -e '
max_depth=5
depth=0
head="ref: $remote_name"
while (expr "z$head" : "zref:" && expr $depth \< $max_depth) >/dev/null
do
remote_name_quoted=$(perl -e '
my $u = $ARGV[0];
$u =~ s/^ref:\s*//;
$u =~ s{([^-a-zA-Z0-9/.])}{sprintf"%%%02x",ord($1)}eg;
print "$u";
' "$remote_name")
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted") &&
' "$head")
head=$(curl -nsfL $curl_extra_args "$remote/$remote_name_quoted")
depth=$( expr \( $depth + 1 \) )
done
expr "z$head" : "z$_x40\$" >/dev/null ||
die "Failed to fetch $remote_name from $remote"
die "Failed to fetch $remote_name from $remote"
echo >&2 Fetching "$remote_name from $remote" using http
git-http-fetch -v -a "$head" "$remote/" || exit
;;
Expand Down
62 changes: 38 additions & 24 deletions git-rebase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,51 @@
#

USAGE='[--onto <newbase>] <upstream> [<branch>]'
LONG_USAGE='git-rebase applies to <upstream> (or optionally to <newbase>) commits
from <branch> that do not appear in <upstream>. When <branch> is not
specified it defaults to the current branch (HEAD).
When git-rebase is complete, <branch> will be updated to point to the
newly created line of commit objects, so the previous line will not be
accessible unless there are other references to it already.
Assuming the following history:
A---B---C topic
/
D---E---F---G master
The result of the following command:
git-rebase --onto master~1 master topic
would be:
A'\''--B'\''--C'\'' topic
/
D---E---F---G master
LONG_USAGE='git-rebase replaces <branch> with a new branch of the
same name. When the --onto option is provided the new branch starts
out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
It then attempts to create a new commit for each commit from the original
<branch> that does not exist in the <upstream> branch.
It is possible that a merge failure will prevent this process from being
completely automatic. You will have to resolve any such merge failure
and run git-rebase --continue. If you can not resolve the merge failure,
running git-rebase --abort will restore the original <branch> and remove
the working files found in the .dotest directory.
Note that if <branch> is not specified on the command line, the
currently checked out branch is used. You must be in the top
directory of your project to start (or continue) a rebase.
Example: git-rebase master~1 topic
A---B---C topic A'\''--B'\''--C'\'' topic
/ --> /
D---E---F---G master D---E---F---G master
'

. git-sh-setup

unset newbase
while case "$#" in 0) break ;; esac
do
case "$1" in
--continue)
diff=$(git-diff-files)
case "$diff" in
?*) echo "You must edit all merge conflicts and then"
echo "mark them as resolved using git update-index"
exit 1
;;
esac
git am --resolved --3way
exit
;;
--abort)
[ -d .dotest ] || die "No rebase in progress?"
git reset --hard ORIG_HEAD
rm -r .dotest
exit
;;
--onto)
test 2 -le "$#" || usage
newbase="$2"
Expand Down
9 changes: 8 additions & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,13 @@ sub send_message
my $to = join (",\n\t", @recipients);
@recipients = unique_email_list(@recipients,@cc);
my $date = strftime('%a, %d %b %Y %H:%M:%S %z', localtime($time++));
my $gitversion = '@@GIT_VERSION@@';
if ($gitversion =~ m/..GIT_VERSION../) {
$gitversion = `git --version`;
chomp $gitversion;
# keep only what's after the last space
$gitversion =~ s/^.* //;
}

my $header = "From: $from
To: $to
Expand All @@ -299,7 +306,7 @@ sub send_message
Reply-To: $from
Date: $date
Message-Id: $message_id
X-Mailer: git-send-email @@GIT_VERSION@@
X-Mailer: git-send-email $gitversion
";
$header .= "In-Reply-To: $reply_to\n" if $reply_to;

Expand Down
12 changes: 6 additions & 6 deletions pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,12 +1032,6 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
max_depth -= cur_entry->delta_limit;
}

size = cur_entry->size;
oldsize = old_entry->size;
sizediff = oldsize > size ? oldsize - size : size - oldsize;

if (size < 50)
return -1;
if (old_entry->depth >= max_depth)
return 0;

Expand All @@ -1048,9 +1042,12 @@ static int try_delta(struct unpacked *cur, struct unpacked *old, unsigned max_de
* more space-efficient (deletes don't have to say _what_ they
* delete).
*/
size = cur_entry->size;
max_size = size / 2 - 20;
if (cur_entry->delta)
max_size = cur_entry->delta_size-1;
oldsize = old_entry->size;
sizediff = oldsize < size ? size - oldsize : 0;
if (sizediff >= max_size)
return 0;
delta_buf = diff_delta(old->data, oldsize,
Expand Down Expand Up @@ -1109,6 +1106,9 @@ static void find_deltas(struct object_entry **list, int window, int depth)
*/
continue;

if (entry->size < 50)
continue;

free(n->data);
n->entry = entry;
n->data = read_sha1_file(entry->sha1, type, &size);
Expand Down
5 changes: 2 additions & 3 deletions repo-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,14 @@ int main(int argc, const char **argv)
type = T_INT;
else if (!strcmp(argv[1], "--bool"))
type = T_BOOL;
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
return git_config(show_all_config);
else
break;
argc--;
argv++;
}

if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l"))
return git_config(show_all_config);

switch (argc) {
case 2:
return get_value(argv[1], NULL);
Expand Down
Loading

0 comments on commit 24e1257

Please sign in to comment.