From: Taylor Blau <me@ttaylorr.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, jonathantanmy@google.com, jrnieder@gmail.com
Subject: [PATCH 3/5] commit: move 'unregister_shallow' to 'shallow.h'
Date: Wed, 29 Apr 2020 16:39:38 -0600 [thread overview]
Message-ID: <65ecfeaba56807926fbe532f94921c98298e50d5.1588199705.git.me@ttaylorr.com> (raw)
In-Reply-To: <cover.1588199705.git.me@ttaylorr.com>
In the last commit, we introduced a header for the functions defined in
'shallow.c'. There is one remaining shallow-related function in
commit.c which should be moved, too. This patch moves that function.
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
commit.c | 13 -------------
shallow.c | 13 +++++++++++++
shallow.h | 1 +
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/commit.c b/commit.c
index eebfbeb45d..87686a7055 100644
--- a/commit.c
+++ b/commit.c
@@ -246,19 +246,6 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
return ret;
}
-int unregister_shallow(const struct object_id *oid)
-{
- int pos = commit_graft_pos(the_repository, oid->hash);
- if (pos < 0)
- return -1;
- if (pos + 1 < the_repository->parsed_objects->grafts_nr)
- MOVE_ARRAY(the_repository->parsed_objects->grafts + pos,
- the_repository->parsed_objects->grafts + pos + 1,
- the_repository->parsed_objects->grafts_nr - pos - 1);
- the_repository->parsed_objects->grafts_nr--;
- return 0;
-}
-
struct commit_buffer {
void *buffer;
unsigned long size;
diff --git a/shallow.c b/shallow.c
index d0191c7609..76e00893fe 100644
--- a/shallow.c
+++ b/shallow.c
@@ -39,6 +39,19 @@ int register_shallow(struct repository *r, const struct object_id *oid)
return register_commit_graft(r, graft, 0);
}
+int unregister_shallow(const struct object_id *oid)
+{
+ int pos = commit_graft_pos(the_repository, oid->hash);
+ if (pos < 0)
+ return -1;
+ if (pos + 1 < the_repository->parsed_objects->grafts_nr)
+ MOVE_ARRAY(the_repository->parsed_objects->grafts + pos,
+ the_repository->parsed_objects->grafts + pos + 1,
+ the_repository->parsed_objects->grafts_nr - pos - 1);
+ the_repository->parsed_objects->grafts_nr--;
+ return 0;
+}
+
int is_repository_shallow(struct repository *r)
{
FILE *fp;
diff --git a/shallow.h b/shallow.h
index 14dd748625..b50a85ed7e 100644
--- a/shallow.h
+++ b/shallow.h
@@ -8,6 +8,7 @@
void set_alternate_shallow_file(struct repository *r, const char *path, int override);
int register_shallow(struct repository *r, const struct object_id *oid);
+int unregister_shallow(const struct object_id *oid);
int is_repository_shallow(struct repository *r);
int commit_shallow_file(struct repository *r, struct lock_file *lk);
void rollback_shallow_file(struct repository *r, struct lock_file *lk);
--
2.26.0.113.ge9739cdccc
next prev parent reply other threads:[~2020-04-29 22:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-29 22:39 [PATCH 0/5] shallow: extract a header file Taylor Blau
2020-04-29 22:39 ` [PATCH 1/5] commit: make 'commit_graft_pos' non-static Taylor Blau
2020-04-30 3:26 ` Jonathan Nieder
2020-04-30 19:22 ` Taylor Blau
2020-04-29 22:39 ` [PATCH 2/5] shallow: extract a header file for shallow-related functions Taylor Blau
2020-04-29 22:48 ` Eric Sunshine
2020-04-30 0:21 ` Jonathan Tan
2020-04-30 0:59 ` Taylor Blau
2020-04-30 18:23 ` Jonathan Tan
2020-04-30 3:19 ` Jonathan Nieder
2020-04-29 22:39 ` Taylor Blau [this message]
2020-04-30 3:13 ` [PATCH 3/5] commit: move 'unregister_shallow' to 'shallow.h' Jonathan Nieder
2020-04-30 19:29 ` Taylor Blau
2020-04-29 22:39 ` [PATCH 4/5] shallow.h: document '{commit,rollback}_shallow_file' Taylor Blau
2020-04-29 22:53 ` Eric Sunshine
2020-04-29 22:39 ` [PATCH 5/5] shallow: use struct 'shallow_lock' for additional safety Taylor Blau
2020-04-29 23:03 ` Eric Sunshine
2020-04-29 23:51 ` Taylor Blau
2020-04-30 0:30 ` Jonathan Tan
2020-04-30 3:11 ` Jonathan Nieder
2020-04-30 5:32 ` Eric Sunshine
2020-04-30 19:32 ` Taylor Blau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65ecfeaba56807926fbe532f94921c98298e50d5.1588199705.git.me@ttaylorr.com \
--to=me@ttaylorr.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonathantanmy@google.com \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).