Hm,
I feeled puzzled here.
Even if I wouldn't recommend to use core.autocrlf, and prefer to use
.gitattributes,
the CRLF conversion should work under Git, but it doensn't seem to do so.
Clone this repo:
origin https://github.com/YueLinHo/TestAutoCrlf.git
Try to see if LF or CRLF can be converted
Michael Haggerty writes:
> It just looks asymmetric, but actually it is symmetric, which was kindof
> surprising when I realized it
>
> Since "|branch ∧ master|" is the same for all candidates, minimizing N
> is the same as maximizing |candidate|, which is the same as
>
> git rev-list --c
On Thu, Jun 19, 2014 at 11:19:09PM -0400, Eric Sunshine wrote:
> > - if (starts_with(command_buf.buf, "M "))
> > - file_change_m(b);
> > - else if (starts_with(command_buf.buf, "D "))
> > - file_change_d(b);
> > -
On Wed, Jun 18, 2014 at 3:56 PM, Jeff King wrote:
> There are several uses of the magic number "line+45" when
> parsing ACK lines from the server, and it's rather unclear
> why 45 is the correct number. We can make this more clear by
> keeping a running pointer as we parse, using skip_prefix to
>
On Wed, Jun 18, 2014 at 3:49 PM, Jeff King wrote:
> Fast-import does a lot of parsing of commands and
> dispatching to sub-functions. For example, given "option
> foo", we might recognize "option " using starts_with, and
> then hand it off to parse_option() to do the rest.
>
> However, we do not l
On Thu, Jun 19, 2014 at 10:30:36PM -0400, Eric Sunshine wrote:
> > diff --git a/git-compat-util.h b/git-compat-util.h
> > index 556c839..1187e1a 100644
> > --- a/git-compat-util.h
> > +++ b/git-compat-util.h
> > @@ -350,8 +350,9 @@ extern int starts_with(const char *str, const char
> > *prefix);
On Thu, Jun 19, 2014 at 10:08 PM, Jeff King wrote:
> On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote:
>
>> > diff --git a/git-compat-util.h b/git-compat-util.h
>> > index b6f03b3..556c839 100644
>> > --- a/git-compat-util.h
>> > +++ b/git-compat-util.h
>> > @@ -349,13 +349,31 @@ exte
On Thu, Jun 19, 2014 at 06:01:47PM -0700, Jonathan Nieder wrote:
> > Speaking of which: are there any power failure corruption cases left
> > in git? How is this tested?
>
> What kind of power failure corruption are you talking about? Git
> usually updates files by writing a completely new file
On Thu, Jun 19, 2014 at 09:59:39PM -0400, Eric Sunshine wrote:
> > diff --git a/git-compat-util.h b/git-compat-util.h
> > index b6f03b3..556c839 100644
> > --- a/git-compat-util.h
> > +++ b/git-compat-util.h
> > @@ -349,13 +349,31 @@ extern void set_die_is_recursing_routine(int
> > (*routine)(voi
We often represent our strings as a counted string, i.e. a pair of the
pointer to the beginning of the string and its length, and the string
may not be NUL terminated to that length.
To compare a pair of such counted strings, unpack-trees.c and
read-cache.c implement their own name_compare() funct
Version 5 of the patch series to cleanup the duplicate name_compare()
functions.
- name-hash.c had a call to cache_name_compare() but it required that
the lengths were equal. Since cache_name_compare() is equivalent to
memcmp() when the lengths are equal, replace it with memcmp().
T
When cache_name_compare() is used on counted strings of the same
length, it is equivalent to a memcmp(). Since the one use of
cache_name_compare() in name-hash.c requires that the lengths are
equal, just replace it with memcmp().
Signed-off-by: Jeremiah Mahler
---
name-hash.c | 2 +-
1 file cha
On Wed, Jun 18, 2014 at 3:44 PM, Jeff King wrote:
> The skip_prefix function returns a pointer to the content
> past the prefix, or NULL if the prefix was not found. While
> this is nice and simple, in practice it makes it hard to use
> for two reasons:
>
> 1. When you want to conditionally skip
Junio,
On Thu, Jun 19, 2014 at 11:29:21AM -0700, Junio C Hamano wrote:
> On Thu, Jun 19, 2014 at 11:03 AM, Junio C Hamano wrote:
> >
> > You chose to use the one that loses the information by unifying
> > these two into the variant that only returns -1/0/+1. We know that
> > it does not matter f
On Thu, Jun 19, 2014 at 01:22:44PM -0400, Jason Pyeron wrote:
> > -Original Message-
> > From: Junio C Hamano
> > Sent: Thursday, June 19, 2014 13:11
> >
> > "brian m. carlson" writes:
> >
> > > I don't know of any place we explicitly copy structs like
> > > this,...
> >
> > which shoul
Nico Williams wrote:
> a) reflogs include information about what's done to the workspace
> (checkout...) that's not relevant to any branch,
Nope, reflogs just record changes to refs and information about why
they happened.
> b) reflogs aren't objects, which ISTM has caused transactional issued
>
Another thing is that branches as objects could store a lot more
information, like:
- the merge-base and HEAD for a rebase (and the --onto)
- the interactive rebase plan! (and diffs to what would have been
the non-interactive plan)
- the would-be no-op non-interactive rebase plan post rebase
On Thu, Jun 19, 2014 at 6:46 PM, Jonathan Nieder wrote:
> Nico Williams wrote:
>
>> - one could see the history of branches, including
>
> Interesting. 'git log -g' is good for getting that information
> locally, but the protocol doesn't have a way to get it from a remote
> server so you have to
Hi,
Nico Williams wrote:
> - one could see the history of branches, including
Interesting. 'git log -g' is good for getting that information
locally, but the protocol doesn't have a way to get it from a remote
server so you have to ssh in. Ronnie (cc-ed) and I were talking
recently about whet
On Thu, Jun 19, 2014 at 05:58:10PM -0400, Jeff King wrote:
> It's still a little more magical than I would like, but I think this is
> the best we can do while still building on get_sha1_hex. Parsing it
> left-to-right would be better, but we would essentially end up
> reimplementing get_sha1_hex.
We get loose object names like "objects/??/..." from the
remote side, and need to convert them to their hex
representation.
The code to do so is rather hard to follow, as it uses some
calculated lengths whose origins are hard to understand and
verify (e.g., the path must be exactly 49 characters l
Sergei Organov writes:
> Junio C Hamano writes:
>
>> Sergei Organov writes:
>>
>>> Will something break if it won't helpfully prepend refs/tags/ once
>>> --all is given?
>>
>> "describe --all --match 'v*'" will no longer match a tag v1.2.3, and
>> forces the users to say "describe --match 'refs
[I'm a list newbie here, but a git power user.]
If branches were objects...
- one could see the history of branches, including
- how commits were grouped when pushed/pulled (push 5 commits, and
the branch object will record that its head moved by those five
commits at once)
- rebase history
When merge-recursive creates a unique filename, it uses a
template like:
path~branch_%d
where the final "_%d" is filled by an incrementing counter
until we find a unique name. We allocate 8 characters for
the counter, but there is no logic to limit the size of the
integer.
Of course, this is e
We sometimes allocate "msg" on the heap, but will fail to
free it if we hit the failure code path. We can instead keep
a separate variable that is safe to be freed no matter how
we get to the failure code path.
While we're here, we can also do two readability
improvements:
1. Use xstrfmt instea
This is shorter, and avoids a rather complicated set of
allocation and free steps.
Signed-off-by: Jeff King
---
merge.c | 42 +-
1 file changed, 13 insertions(+), 29 deletions(-)
diff --git a/merge.c b/merge.c
index 70f1000..1fa6e52 100644
--- a/merge.c
+
This avoids a manual allocation calculation, and is shorter
to boot.
Signed-off-by: Jeff King
---
sequencer.c | 9 ++---
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 0a80c58..2fea824 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -396,18 +396,1
This is shorter, harder to get wrong, and more clearly
captures the intent.
Signed-off-by: Jeff King
---
I wondered if there was a reason to avoid this (because we are in
setup_git_env, which can potentially be called by git_pathdup). But the
git_graft_file initialization below already uses it, a
It's easy to get manual allocation calculations wrong, and
the use of strcpy/strcat raise red flags for people looking
for buffer overflows (though in this case each site was
fine).
It's also shorter to use xstrfmt, and the printf-format
tends to be easier for a reader to see what the final string
This is one line shorter, and makes sure the length in the
malloc and sprintf steps match.
These conversions are very straightforward; we can drop the
malloc entirely, and replace the sprintf with xstrfmt.
Signed-off-by: Jeff King
---
Just a note on one thing I would look for as a reviewer:
I
In many parts of the code, we do an ugly and error-prone
malloc like:
const char *fmt = "something %s";
buf = xmalloc(strlen(foo) + 10 + 1);
sprintf(buf, fmt, foo);
This makes the code brittle, and if we ever get the
allocation wrong, is a potential heap overflow. Let's
instead favor xstrfm
This is one line shorter, and makes sure the length in the
malloc and copy steps match.
Signed-off-by: Jeff King
---
builtin/receive-pack.c | 5 +
http-push.c| 6 ++
http-walker.c | 3 +--
3 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/builtin/receiv
You can use a strbuf to build up a string from parts, and
then detach it. In the general case, you might use multiple
strbuf_add* functions to do the building. However, in many
cases, a single strbuf_addf is sufficient, and we end up
with:
struct strbuf buf = STRBUF_INIT;
...
strbuf_addf(&bu
On Thu, Jun 19, 2014 at 09:49:41AM -0700, Junio C Hamano wrote:
> If we twist the logic behind the 'mkpathdup' name a little bit,
> perhaps we can call it sprintf_dup or something. That is, "sprintf
> wants a fixed preallocated piece of memory to print into, and we
> relieve the callers of having
Junio,
On Thu, Jun 19, 2014 at 11:03:03AM -0700, Junio C Hamano wrote:
> Jeremiah Mahler writes:
>
> > Both unpack-trees.c and read-cache.c have their own name_compare()
> > function, which are identical. And read-cache.c has a
> > cache_name_compare() function which is nearly identical to
> >
Duy Nguyen writes:
> On Thu, Jun 19, 2014 at 12:25 AM, Junio C Hamano wrote:
>> [Stalled]
>> * nd/multiple-work-trees (2014-03-25) 28 commits
>> - count-objects: report unused files in $GIT_DIR/repos/...
>> - gc: support prune --repos
>> - gc: style change -- no SP before closing bracket
>>
Test that the revert command updates the work tree as expected (for
submodule changes which don't result in conflicts). Add a helper function
to first revert the checked out target commit to make the last revert
produce the to-be-tested work tree.
Set the KNOWN_FAILURE_CHERRY_PICK_SEES_EMPTY_COMMI
Test that the rebase command updates the work tree as expected for
changes which don't result in conflicts. To make that work add two
helper functions that add a commit only touching files and then
revert it. This allows to rebase the target commit over these two
and to compare the result.
Set KNO
Test that the stash apply command updates the work tree as expected for
changes which don't result in conflicts. To make that work add a helper
function that uses read-tree to apply the changes of the target commit
to the work tree, then stashes these changes and at last applies that
stash.
Implem
Add this test library to simplify covering all combinations of submodule
update scenarios without having to add those to a test of each work tree
manipulating command over and over again.
The functions test_submodule_switch() and test_submodule_forced_switch()
are intended to be called from a test
For the upcoming submodule test framework we often need to assert that an
empty directory exists in the work tree. Add the test_dir_is_empty()
function which asserts that the given argument is an empty directory.
Signed-off-by: Jens Lehmann
---
Changes to v1:
*) Added "-n" to test expression (
Test that the bisect command updates the work tree as expected. To make
that work with the new submodule test framework a git_bisect helper
function is added. This adds a commit after the one given to be switched
to and makes that one the bad commit. The starting point is then given to
bisect as th
Junio C Hamano writes:
> Sergei Organov writes:
>
>> Will something break if it won't helpfully prepend refs/tags/ once
>> --all is given?
>
> "describe --all --match 'v*'" will no longer match a tag v1.2.3, and
> forces the users to say "describe --match 'refs/tags/v*'",
No,
descirbe --match
Sergei Organov writes:
> Will something break if it won't helpfully prepend refs/tags/ once
> --all is given?
"describe --all --match 'v*'" will no longer match a tag v1.2.3, and
forces the users to say "describe --match 'refs/tags/v*'", and these
users will probably see it as a new breakage, I
Junio C Hamano writes:
> Sergei Organov writes:
>
>> Just playing with it, got some surprises:
>>
>> $ git --version
>> git version 1.9.3
>>
>> $ git describe --all
>> heads/v3.5
>> $ git describe --all --match 'v*'
>> tags/v3.5.6b2-4-gab4bf78
>> $ git describe --all --match 'heads/v*'
>> fatal:
On Thu, Jun 19, 2014 at 11:03 AM, Junio C Hamano wrote:
>
> You chose to use the one that loses the information by unifying
> these two into the variant that only returns -1/0/+1. We know that
> it does not matter for the current callers, but is it expected that
> no future callers will benefit b
Jeremiah Mahler writes:
> Both unpack-trees.c and read-cache.c have their own name_compare()
> function, which are identical. And read-cache.c has a
> cache_name_compare() function which is nearly identical to
> name_compare() [1]. The cache_name_compare() function is not specific
> to a cache,
> -Original Message-
> From: Junio C Hamano
> Sent: Thursday, June 19, 2014 13:11
>
> "brian m. carlson" writes:
>
> > I don't know of any place we explicitly copy structs like
> > this,...
>
> which should be a reason enough. The first concrete guideline is
> "just imitate the existin
Sergei Organov writes:
> Just playing with it, got some surprises:
>
> $ git --version
> git version 1.9.3
>
> $ git describe --all
> heads/v3.5
> $ git describe --all --match 'v*'
> tags/v3.5.6b2-4-gab4bf78
> $ git describe --all --match 'heads/v*'
> fatal: No names found, cannot describe anythi
"brian m. carlson" writes:
> I don't know of any place we explicitly copy structs like
> this,...
which should be a reason enough. The first concrete guideline is
"just imitate the existing code".
> but I don't know of any prohibition against it, either.
So now you know ;-).
--
To unsubscribe
Am 19.06.2014 11:05, schrieb Jeff King:
On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote:
str = xstrdup_fmt(fmt, some, args);
---
I'm open to suggestions on the name. This really is the same thing
conceptually as the GNU asprintf(), but the interface is different (that
function
Jeff King writes:
> On Wed, Jun 18, 2014 at 03:32:08PM -0700, Junio C Hamano wrote:
>
>> > str = xstrdup_fmt(fmt, some, args);
>> > ---
>> > I'm open to suggestions on the name. This really is the same thing
>> > conceptually as the GNU asprintf(), but the interface is different (that
>> > func
Making errno when returning from lock_file() meaningful, which should
fix
* an existing almost-bug in lock_ref_sha1_basic where it assumes
errno==ENOENT is meaningful and could waste some work on retries
* an existing bug in repack_without_refs where it prints
strerror(errno) and picks ad
Making errno when returning from log_ref_setup() meaningful,
Signed-off-by: Ronnie Sahlberg
---
refs.c | 27 +++
refs.h | 4 +++-
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/refs.c b/refs.c
index 67a0217..9ea519c 100644
--- a/refs.c
+++ b/refs.c
@@ -2
Add a strbuf argument to _commit so that we can pass an error string back to
the caller. So that we can do error logging from the caller instead of from
_commit.
Longer term plan is to first convert all callers to use onerr==QUIET_ON_ERR
and craft any log messages from the callers themselves and f
Making errno when returning from commit_packed_refs() meaningful,
which should fix
* a bug in "git clone" where it prints strerror(errno) based on
errno, despite errno possibly being zero and potentially having
been clobbered by that point
* the same kind of bug in "git pack-refs"
and pre
Introducing a new unable_to_lock_message helper, which has nicer
semantics than unable_to_lock_error and cleans up lockfile.c a little.
Signed-off-by: Ronnie Sahlberg
---
cache.h| 2 ++
lockfile.c | 22 --
2 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/
I have resent v19 that does
1, remove the spurios redundant errno line
2, fixes the type
and
3, reorders the patch as mentioned previously in this thread.
This I hope will be the final version of the series we will need.
regards
ronnie sahlberg
On Wed, Jun 18, 2014 at 3:38 PM, Michael Haggerty
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 1 +
refs.c | 1 -
refs.h | 5 ++---
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 405267f..1fd7a89 100644
--- a/b
Making errno from write_ref_sha1() meaningful, which should fix
* a bug in "git checkout -b" where it prints strerror(errno)
despite errno possibly being zero or clobbered
* a bug in "git fetch"'s s_update_ref, which trusts the result of an
errno == ENOTDIR check to detect D/F conflicts
Sign
Update ref_transaction_update() do some basic error checking and return
non-zero on error. Update all callers to check ref_transaction_update() for
error. There are currently no conditions in _update that will return error but
there will be in the future. Add an err argument that will be updated on
Making errno when returning from remove_empty_directories() more
obviously meaningful, which should provide some peace of mind for
people auditing lock_ref_sha1_basic.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 5 -
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/refs.c b/refs.
Call ref_transaction_commit with QUIET_ON_ERR and use the strbuf that is
returned to print a log message if/after the transaction fails.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)
diff --
No external callers reference lock_ref_sha1 any more so lets declare it static.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 2 +-
refs.h | 6 --
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/refs.c b/refs.c
index 8b2c598..db8e0a0 100644
--- a/ref
Making errno when returning from resolve_ref_unsafe() meaningful,
which should fix
* a bug in lock_ref_sha1_basic, where it assumes EISDIR
means it failed due to a directory being in the way
Signed-off-by: Ronnie Sahlberg
---
cache.h | 2 +-
refs.c | 19 +++
2 files change
Change create_branch to use a ref transaction when creating the new branch.
This also fixes a race condition in the old code where two concurrent
create_branch could race since the lock_any_ref_for_update/write_ref_sha1
did not protect against the ref already existing. I.e. one thread could end up
We do not yet need both a rollback and a free function for transactions.
Remove ref_transaction_rollback and use ref_transaction_free instead.
At a later stage we may reintroduce a rollback function if we want to start
adding reusable transactions and similar.
Reviewed-by: Jonathan Nieder
Signed
Since all callers now use QUIET_ON_ERR we no longer need to provide an onerr
argument any more. Remove the onerr argument from the ref_transaction_commit
signature.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/update-ref.c | 3 +--
refs.c | 22 +++--
Change tag.c to use ref transactions for all ref updates.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/tag.c | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index c6e8a71..c9bfc9a 100644
--- a/builtin/t
Add an err argument to _begin so that on non-fatal failures in future ref
backends we can report a nice error back to the caller.
While _begin can currently never fail for other reasons than OOM, in which
case we die() anyway, we may add other types of backends in the future.
For example, a hypothe
Change ref_transaction_delete() to do basic error checking and return
non-zero of error. Update all callers to check the return for
ref_transaction_delete(). There are currently no conditions in _delete that
will return error but there will be in the future. Add an err argument that
will be updated
Since we only call update_ref_write from a single place and we only call it
with onerr==QUIET_ON_ERR we can just as well get rid of it and just call
write_ref_sha1 directly. This changes the return status for _commit from
1 to -1 on failures when writing to the ref. Eventually we will want
_commit
Change to use ref transactions for all updates to refs.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
sequencer.c | 24
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index 0a80c58..fd8acaf 100644
--- a/sequenc
Change commit.c to use ref transactions for all ref updates.
Make sure we pass a NULL pointer to ref_transaction_update if have_old
is false.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/commit.c | 24 +++-
1 file changed, 11 insertions(+), 13 dele
Track the status of a transaction in a new status field. Check the field for
sanity, i.e. that status must be OPEN when _commit/_create/_delete or
_update is called or else die(BUG:...)
Signed-off-by: Ronnie Sahlberg
---
refs.c | 40 +++-
1 file changed, 39 in
Do basic error checking in ref_transaction_create() and make it return
non-zero on error. Update all callers to check the result of
ref_transaction_create(). There are currently no conditions in _create that
will return error but there will be in the future. Add an err argument that
will be updated
Change delete_ref to use a ref transaction for the deletion. At the same time
since we no longer have any callers of repack_without_ref we can now delete
this function.
Change delete_ref to return 0 on success and 1 on failure instead of the
previous 0 on success either 1 or -1 on failure.
Review
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 29 +++--
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index cd929dc..191fc47 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1734,15 +1734,3
Wrap all the ref updates inside a transaction.
Signed-off-by: Ronnie Sahlberg
---
builtin/receive-pack.c | 96 +-
1 file changed, 63 insertions(+), 33 deletions(-)
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index c323081..b51f8ae
Change update_branch() to use ref transactions for updates.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
fast-import.c | 26 +++---
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 6707a66..cd929dc 100644
Update repack_without_refs to take an err argument and update it if there
is a failure. Pass the err variable from ref_transaction_commit to this
function so that callers can print a meaningful error message if _commit
fails due to this function.
Signed-off-by: Ronnie Sahlberg
---
builtin/remote
We call read_ref_full with a pointer to flags from rename_ref but since
we never actually use the returned flags we can just pass NULL here instead.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/refs.c
Change s_update_ref to use a ref transaction for the ref update.
Signed-off-by: Ronnie Sahlberg
---
builtin/fetch.c | 33 +++--
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index faa1233..52f1ebc 100644
--- a/builti
lock_ref_sha1 was only called from one place in refc.c and only provided
a check that the refname was sane before adding back the initial "refs/"
part of the ref path name, the initial "refs/" that this caller had already
stripped off before calling lock_ref_sha1.
Reviewed-by: Jonathan Nieder
Sig
Switch to using ref transactions in walker_fetch(). As part of the refactoring
to use ref transactions we also fix a potential memory leak where in the
original code if write_ref_sha1() would fail we would end up returning from
the function without free()ing the msg string.
Note that this function
Allow ref_transaction_free(NULL) as a no-op. This makes ref_transaction_free
easier to use and more similar to plain 'free'.
In particular, it lets us rollback unconditionally as part of cleanup code
after setting 'transaction = NULL' if a transaction has been committed or
rolled back already.
Re
Change the reference transactions so that we pass the reflog message
through to the create/delete/update function instead of the commit message.
This allows for individual messages for each change in a multi ref
transaction.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
branch
Since we now only call update_ref_lock with onerr==QUIET_ON_ERR we no longer
need this function and can replace it with just calling lock_any_ref_for_update
directly.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 30 ++
1 file changed, 6 in
Make ref_update_reject_duplicates return any error that occurs through a
new strbuf argument. This means that when a transaction commit fails in
this function we will now be able to pass a helpful error message back to the
caller.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
In _commit, ENOTDIR can happen in the call to lock_ref_sha1_basic, either when
we lstat the new refname and it returns ENOTDIR or if the name checking
function reports that the same type of conflict happened. In both cases it
means that we can not create the new ref due to a name conflict.
For the
Add an err argument to delete_loose_ref so that we can pass a descriptive
error string back to the caller. Pass the err argument from transaction
commit to this function so that transaction users will have a nice error
string if the transaction failed due to delete_loose_ref.
Add a new function un
Move the check for check_refname_format from lock_any_ref_for_update
to lock_ref_sha1_basic. At some later stage we will get rid of
lock_any_ref_for_update completely.
If lock_ref_sha1_basic fails the check_refname_format test, set errno to
EINVAL before returning NULL. This to guarantee that we w
Change prune_ref to delete the ref using a ref transaction. To do this we also
need to add a new flag REF_ISPRUNING that will tell the transaction that we
do not want to delete this ref from the packed refs. This flag is private to
refs.c and not exposed to external callers.
Reviewed-by: Jonathan
Change the update_ref helper function to use a ref transaction internally.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 25 +
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 8c695ba..8b2c598 100644
--- a/re
Allow passing a list of refs to skip checking to name_conflict_fn.
There are some conditions where we want to allow a temporary conflict and skip
checking those refs. For example if we have a transaction that
1, guarantees that m is a packed refs and there is no loose ref for m
2, the transaction w
Making errno when returning from verify_lock() meaningful, which
should almost but not completely fix
* a bug in "git fetch"'s s_update_ref, which trusts the result of an
errno == ENOTDIR check to detect D/F conflicts
ENOTDIR makes sense as a sign that a file was in the way of a
directory we
Change update_ref_write to also update an error strbuf on failure.
This makes the error available to ref_transaction_commit callers if the
transaction failed due to update_ref_sha1/write_ref_sha1 failures.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 9 ++---
1 f
Skip using the lock_any_ref_for_update wrapper and call lock_ref_sha1_basic
directly from the commit function.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
refs.c | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/refs.c b/refs.c
index 5a7fb34..2
No external users call write_ref_sha1 any more so lets declare it static.
Signed-off-by: Ronnie Sahlberg
---
refs.c | 10 --
refs.h | 3 ---
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/refs.c b/refs.c
index f4234b9..1529a26 100644
--- a/refs.c
+++ b/refs.c
@@ -2665,6
Update replace.c to use ref transactions for updates.
Reviewed-by: Jonathan Nieder
Signed-off-by: Ronnie Sahlberg
---
builtin/replace.c | 17 ++---
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/builtin/replace.c b/builtin/replace.c
index 1bb491d..054f5ef 100644
---
1 - 100 of 119 matches
Mail list logo