File indexing completed on 2025-01-19 04:22: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 "commandfetch.h"
0008 
0009 namespace Git
0010 {
0011 
0012 bool CommandFetch::noFf() const
0013 {
0014     return mNoFf;
0015 }
0016 
0017 void CommandFetch::setNoFf(bool newNoFf)
0018 {
0019     mNoFf = newNoFf;
0020 }
0021 
0022 bool CommandFetch::ffOnly() const
0023 {
0024     return mFfOnly;
0025 }
0026 
0027 void CommandFetch::setFfOnly(bool newFfOnly)
0028 {
0029     mFfOnly = newFfOnly;
0030 }
0031 
0032 bool CommandFetch::noCommit() const
0033 {
0034     return mNoCommit;
0035 }
0036 
0037 void CommandFetch::setNoCommit(bool newNoCommit)
0038 {
0039     mNoCommit = newNoCommit;
0040 }
0041 
0042 bool CommandFetch::prune() const
0043 {
0044     return mPrune;
0045 }
0046 
0047 void CommandFetch::setPrune(bool newPrune)
0048 {
0049     mPrune = newPrune;
0050 }
0051 
0052 bool CommandFetch::tags() const
0053 {
0054     return mTags;
0055 }
0056 
0057 void CommandFetch::setTags(bool newTags)
0058 {
0059     mTags = newTags;
0060 }
0061 
0062 void CommandFetch::parseOutputSection(const QByteArray &output, const QByteArray &errorOutput)
0063 {
0064     Q_UNUSED(output)
0065     Q_UNUSED(errorOutput)
0066 }
0067 
0068 const QString &CommandFetch::remote() const
0069 {
0070     return mRemote;
0071 }
0072 
0073 void CommandFetch::setRemote(const QString &newRemote)
0074 {
0075     mRemote = newRemote;
0076 }
0077 
0078 const QString &CommandFetch::branch() const
0079 {
0080     return mBranch;
0081 }
0082 
0083 void CommandFetch::setBranch(const QString &newBranch)
0084 {
0085     mBranch = newBranch;
0086 }
0087 
0088 QStringList CommandFetch::generateArgs() const
0089 {
0090     QStringList args{QStringLiteral("fetch"), mRemote};
0091     if (!mBranch.isEmpty())
0092         args.append(mBranch);
0093     if (mNoFf)
0094         args.append(QStringLiteral("--no-ff"));
0095     if (mFfOnly)
0096         args.append(QStringLiteral("--ff-only"));
0097     if (mNoCommit)
0098         args.append(QStringLiteral("--no-commit"));
0099     if (mPrune)
0100         args.append(QStringLiteral("--prune"));
0101     if (mTags)
0102         args.append(QStringLiteral("--tags"));
0103     return args;
0104 }
0105 
0106 CommandFetch::CommandFetch() = default;
0107 
0108 } // namespace Git