File indexing completed on 2025-03-09 05:11:43
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include "checkoutoptions.h" 0008 0009 namespace Git 0010 { 0011 0012 CheckoutOptions::CheckoutOptions() 0013 { 0014 } 0015 0016 void CheckoutOptions::applyToCheckoutOptions(git_checkout_options *opts) const 0017 { 0018 int strategy{0}; 0019 0020 if (mSafe) 0021 strategy += GIT_CHECKOUT_SAFE; 0022 if (mForce) 0023 strategy += GIT_CHECKOUT_FORCE; 0024 if (mRecreateMissing) 0025 strategy += GIT_CHECKOUT_RECREATE_MISSING; 0026 if (mAllowConflicts) 0027 strategy += GIT_CHECKOUT_ALLOW_CONFLICTS; 0028 if (mRemoveUntracked) 0029 strategy += GIT_CHECKOUT_REMOVE_UNTRACKED; 0030 if (mRemoveIgnored) 0031 strategy += GIT_CHECKOUT_REMOVE_IGNORED; 0032 if (mUpdateOnly) 0033 strategy += GIT_CHECKOUT_UPDATE_ONLY; 0034 if (mDontUpdateIndex) 0035 strategy += GIT_CHECKOUT_DONT_UPDATE_INDEX; 0036 if (mNoRefresh) 0037 strategy += GIT_CHECKOUT_NO_REFRESH; 0038 if (mSkipUnmerged) 0039 strategy += GIT_CHECKOUT_SKIP_UNMERGED; 0040 if (mUseOurs) 0041 strategy += GIT_CHECKOUT_USE_OURS; 0042 if (mUseTheirs) 0043 strategy += GIT_CHECKOUT_USE_THEIRS; 0044 if (mDisablePathspecMatch) 0045 strategy += GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH; 0046 if (mSkipLockedDirectories) 0047 strategy += GIT_CHECKOUT_SKIP_LOCKED_DIRECTORIES; 0048 if (mDontOverwriteIgnored) 0049 strategy += GIT_CHECKOUT_DONT_OVERWRITE_IGNORED; 0050 if (mConflictStyleMerge) 0051 strategy += GIT_CHECKOUT_CONFLICT_STYLE_MERGE; 0052 if (mConflictStyleDiFF3) 0053 strategy += GIT_CHECKOUT_CONFLICT_STYLE_DIFF3; 0054 if (mDontRemoveExisting) 0055 strategy += GIT_CHECKOUT_DONT_REMOVE_EXISTING; 0056 if (mDontWriteIndex) 0057 strategy += GIT_CHECKOUT_DONT_WRITE_INDEX; 0058 if (mUpdateSubmodules) 0059 strategy += GIT_CHECKOUT_UPDATE_SUBMODULES; 0060 if (mUpdateSubmodulesIfChanged) 0061 strategy += GIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED; 0062 0063 opts->checkout_strategy = strategy; 0064 0065 if (!mAncestorLabel.isEmpty()) 0066 opts->ancestor_label = mAncestorLabel.toLocal8Bit().constData(); 0067 if (!mOurLabel.isEmpty()) 0068 opts->our_label = mOurLabel.toLocal8Bit().constData(); 0069 if (!mTheirLabel.isEmpty()) 0070 opts->their_label = mTheirLabel.toLocal8Bit().constData(); 0071 } 0072 0073 } // namespace Git