Git: Add Sign off feature in git commit view

Change-Id: Icb0a8818f707d6a874a9b97318fc6a93205b4ce9
Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tasuku Suzuki
2016-12-26 09:46:25 +09:00
committed by Orgad Shaneh
parent 405c456d0d
commit ac83af4ef0
5 changed files with 40 additions and 23 deletions

View File

@@ -44,6 +44,7 @@ void GitSubmitEditorPanelData::clear()
email.clear(); email.clear();
bypassHooks = false; bypassHooks = false;
pushAction = NoPush; pushAction = NoPush;
signOff = false;
} }
QString GitSubmitEditorPanelData::authorString() const QString GitSubmitEditorPanelData::authorString() const

View File

@@ -60,6 +60,7 @@ public:
QString email; QString email;
bool bypassHooks; bool bypassHooks;
PushAction pushAction; PushAction pushAction;
bool signOff;
}; };
enum FileState { enum FileState {

View File

@@ -2529,6 +2529,8 @@ bool GitClient::addAndCommit(const QString &repositoryDirectory,
arguments << "--author" << authorString; arguments << "--author" << authorString;
if (data.bypassHooks) if (data.bypassHooks)
arguments << "--no-verify"; arguments << "--no-verify";
if (data.signOff)
arguments << "--signoff";
} }
const SynchronousProcessResponse resp = vcsFullySynchronousExec(repositoryDirectory, arguments); const SynchronousProcessResponse resp = vcsFullySynchronousExec(repositoryDirectory, arguments);

View File

@@ -137,6 +137,7 @@ GitSubmitEditorPanelData GitSubmitEditorWidget::panelData() const
} }
rc.bypassHooks = m_gitSubmitPanelUi.bypassHooksCheckBox->isChecked(); rc.bypassHooks = m_gitSubmitPanelUi.bypassHooksCheckBox->isChecked();
rc.pushAction = m_pushAction; rc.pushAction = m_pushAction;
rc.signOff = m_gitSubmitPanelUi.signOffCheckBox->isChecked();
return rc; return rc;
} }
@@ -147,6 +148,7 @@ void GitSubmitEditorWidget::setPanelData(const GitSubmitEditorPanelData &data)
m_gitSubmitPanelUi.authorLineEdit->setText(data.author); m_gitSubmitPanelUi.authorLineEdit->setText(data.author);
m_gitSubmitPanelUi.emailLineEdit->setText(data.email); m_gitSubmitPanelUi.emailLineEdit->setText(data.email);
m_gitSubmitPanelUi.bypassHooksCheckBox->setChecked(data.bypassHooks); m_gitSubmitPanelUi.bypassHooksCheckBox->setChecked(data.bypassHooks);
m_gitSubmitPanelUi.signOffCheckBox->setChecked(data.signOff);
authorInformationChanged(); authorInformationChanged();
} }

View File

@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>364</width> <width>364</width>
<height>198</height> <height>269</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
@@ -80,7 +80,7 @@
<widget class="QLineEdit" name="authorLineEdit"> <widget class="QLineEdit" name="authorLineEdit">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>200</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
@@ -101,12 +101,9 @@
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>5</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@@ -123,13 +120,13 @@
<widget class="QLineEdit" name="emailLineEdit"> <widget class="QLineEdit" name="emailLineEdit">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>150</width> <width>200</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2" colspan="2">
<widget class="QLabel" name="invalidEmailLabel"> <widget class="QLabel" name="invalidEmailLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@@ -140,21 +137,35 @@
</widget> </widget>
</item> </item>
<item row="2" column="1"> <item row="2" column="1">
<widget class="QCheckBox" name="bypassHooksCheckBox"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="text"> <item>
<string/> <widget class="QCheckBox" name="bypassHooksCheckBox">
</property> <property name="text">
</widget> <string>By&amp;pass hooks</string>
</item> </property>
<item row="2" column="0"> </widget>
<widget class="QLabel" name="label"> </item>
<property name="text"> <item>
<string>By&amp;pass hooks:</string> <widget class="QCheckBox" name="signOffCheckBox">
</property> <property name="text">
<property name="buddy"> <string>&amp;Sign off</string>
<cstring>bypassHooksCheckBox</cstring> </property>
</property> </widget>
</widget> </item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>