-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
727905b adding a new API to duration timer (#152) 9406717 add missing "extern C" qualifiers to a few headers for C++ linking; (#150) a0aafdf Add missing semicolon to ring array example code in documentation. (#149) 9264bbb Zero byte (#147) (emergency fix needed for pelikan) d4002d7 simplify cc_print_int64 (#146) b164fcf Clean-up hash functions and introduce MurmurHash3 (#145) b1babb2 change wheel's sleep timer to make it less flaky (#143) ce0b9ea allow printing negative integers in cc_print (#141) ab0edc8 add metrics to track buf_sock objects (#138) ae02038 add travis ci (copied from pelikan) (#139) 964645a Merge pull request #135 from paegun/fix_cmake_install 70710c2 fixed and re-added cmake install instructions, w/ following notes: include directory made proper relative; opened pattern match b/c include directory should only contain files meant for inclusion. 5b095bc Merge pull request #126 from kevyang/kevyang/120 426d56a return NULL when cc_alloc/cc_realloc is called with size == 0 ad271d4 Merge pull request #133 from kevyang/132 47dbdba suppress unused parameter warning in debug_log_flush 648d19e Merge pull request #127 from kevyang/56 780941a Merge pull request #130 from kevyang/129 b8af6c0 Merge pull request #131 from kevyang/128 6ecc318 fix duplicate symbols in cc_signal 080c41d cc_array - stop doing arithmetic on void * d526f7a add debug oriented memory management a4fb927 Update bool member rules in style guide 05c6e1e explicitly make ccommon a C project to avoid checking for CXX related variables git-subtree-dir: deps/ccommon git-subtree-split: 727905b
- Loading branch information
Yao Yue
authored
May 19, 2018
1 parent
390dab1
commit 1196b58
Showing
10 changed files
with
119 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
# deps | ||
|
||
The deps directory contains all the dependencies shipped as source packages. The project level CMakeLists.txt contains additional dependencies. | ||
The deps directory contains all the dependencies shipped as source packages. The | ||
project level CMakeLists.txt contains additional dependencies. | ||
|
||
All packages in this directory are tracked using git subtree. For more information, follow the original [git-subtree documentation](https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt) | ||
All packages in this directory are tracked using git subtree. For more | ||
information, follow the original [git-subtree documentation](https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt) | ||
|
||
## List of dependencies | ||
* ccommon(libccommon): a library providing generic, low-level functionalities useful for writing a RPC service. | ||
* ccommon(libccommon): a library providing generic, low-level functionalities | ||
useful for writing a RPC service. | ||
|
||
## ccommon | ||
|
||
|
@@ -17,16 +20,23 @@ git remote add ccommon_remote [email protected]:twitter/ccommon.git | |
The first time we merge ccommon into deps, the following command was executed. | ||
```bash | ||
git checkout master | ||
git subtree add --prefix=deps/ccommon/ ccommon_remote master --squash | ||
git subtree add --prefix=deps/ccommon ccommon_remote master --squash | ||
``` | ||
|
||
To update ccommon with upstream/remote changes | ||
```bash | ||
git fetch ccommon_remote master | ||
git subtree pull --prefix=deps/ccommon/ --squash ccommon_remote master | ||
git subtree pull --prefix=deps/ccommon --squash ccommon_remote master | ||
``` | ||
|
||
To update upstream/remote with local changes involves somewhat complicated commands. At a high level, this is done in two steps: first, the local history needs to be sifted to isolate changes that are relevant to the subtree (deps/ccommon in our case), and an alternative "timeline" or history suitable for committing to the remote is created; second, this alternative history is pushed back to the remote. See Notes and subtree's github repo for more information. | ||
To update upstream/remote with local changes involves somewhat complicated | ||
commands. At a high level, this is done in two steps: first, the local history | ||
needs to be sifted to isolate changes that are relevant to the subtree | ||
(`deps/ccommon` in our case), and an alternative "timeline" or history suitable | ||
for committing to the remote is created; second, this alternative history is | ||
pushed back to the remote. See Notes and subtree's github repo for more | ||
information. | ||
|
||
```bash | ||
# first find out the last SHA of a merge from upstream, in this example it is a06437 | ||
git subtree split --prefix=deps/ccommon --annotate='ccommon: ' a064371781e7fa4be044b80353dde9014353d6a5^.. -b ccommon_update | ||
|
@@ -38,14 +48,37 @@ git push ccommon_remote ccommon_update:master | |
# Notes | ||
|
||
## Why subtree? | ||
There are two goals we try to achieve: a) manage dependencies explicitly; b) make the repo easy to use for most people, not just main developers. | ||
The dependency management went through three phases: no management at all (two free standing repos); use of git submodule; use of git subtree. It was very clear that no dependency management was absolutely unacceptable, build broke all the time. Git submodule is the first thing we tried, and it is fairly easy to make changes within the submodule and merge the changes back to upstream. However, since submodules require extra options to be fully checked out or updated, it becomes harder to use especially for people unfamiliar with the project. | ||
There are two goals we try to achieve: a) manage dependencies explicitly; | ||
b) make the repo easy to use for most people, not just main developers. | ||
The dependency management went through three phases: no management at all (two | ||
free standing repos); use of git submodule; use of git subtree. It was very | ||
clear that no dependency management was absolutely unacceptable, build broke all | ||
the time. Git submodule is the first thing we tried, and it is fairly easy to | ||
make changes within the submodule and merge the changes back to upstream. | ||
However, since submodules require extra options to be fully checked out or | ||
updated, it becomes harder to use especially for people unfamiliar with the | ||
project. | ||
|
||
Git subtree actually means two things: the subtree mechanism that manages sub-repository using native git commands, and the git subtree extension, which is mostly a bash script. With the former, it is rather difficult to merge changes in the sub-repository upstream. This is handled by the `split` command in the git-subtree extension, which makes it feasible. There simply isn't an elegant solution out there for our purpose, and subtree seems to be the best compromise so far given our goals. | ||
Git subtree actually means two things: the subtree mechanism that manages | ||
sub-repository using native git commands, and the git subtree extension, which | ||
is mostly a bash script. With the former, it is rather difficult to merge | ||
changes in the sub-repository upstream. This is handled by the `split` command | ||
in the git-subtree extension, which makes it feasible. There simply isn't an | ||
elegant solution out there for our purpose, and subtree seems to be the best | ||
compromise so far given our goals. | ||
|
||
## Merge direction | ||
As a result of the complexity of merging to upstream, we prefer working on dependencies in their own repo, and update the parent repo by pulling. Merging upstream is possible but not encouraged. | ||
As a result of the complexity of merging to upstream, we prefer working on | ||
dependencies in their own repo, and update the parent repo by pulling. Merging | ||
upstream is possible but not encouraged. | ||
|
||
## Handle git history | ||
We decide to use `--squash` when merging to keep most of the dependency history out of the parent project. This cuts down noise in the parent repo. | ||
We also choose not to use the `--rejoin` option of git-subtree, because this option creates an extra entry in git log to mark the current split location. This also introduces noise into git history that means little to those who don't use subtree. Without this option, `git subtree split` by default scans the entire history of the parent project, which can take a while if there has been a long history. To speed things up, one can provide a range of SHA to scan from, which usually means git only has to go through the last few changes. | ||
We decide to use `--squash` when merging to keep most of the dependency history | ||
out of the parent project. This cuts down noise in the parent repo. | ||
We also choose not to use the `--rejoin` option of git-subtree, because this | ||
option creates an extra entry in git log to mark the current split location. | ||
This also introduces noise into git history that means little to those who don't | ||
use subtree. Without this option, `git subtree split` by default scans the | ||
entire history of the parent project, which can take a while if there has been a | ||
long history. To speed things up, one can provide a range of SHA to scan from, | ||
which usually means git only has to go through the last few changes. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters